Name

setMag()

Class

PVector

Description

Set the magnitude of this vector to the value used for the len parameter.

Examples

  • PVector v = new PVector(3, 4, 0);
    v.setMag(10);
    println(v);  // Prints "[ 6.0, 8.0, 0.0 ]"
    

Syntax

  • .setMag(len)
  • .setMag(target, len)

Parameters

  • len(float)the new length for this vector
  • target(PVector)Set to null to create a new vector
  • len(float)the new length for the new vector

Return

  • PVector