PVector

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods  Modifier and Type Method and Description PVector add(float x, float y)  PVector add(float x, float y, float z)  PVector add(PVector v)

( begin auto-generated from PVector_add.xml ) Adds x, y, and z components to a vector, adds one vector to another, or adds two independent vectors together.

static PVector add(PVector v1, PVector v2)

Add two vectors

static PVector add(PVector v1, PVector v2, PVector target)

Add two vectors into a target vector

static float angleBetween(PVector v1, PVector v2)

( begin auto-generated from PVector_angleBetween.xml ) Calculates and returns the angle (in radians) between two vectors.

float[] array()

( begin auto-generated from PVector_array.xml ) Return a representation of this vector as a float array.

PVector copy()

( begin auto-generated from PVector_copy.xml ) Gets a copy of the vector, returns a PVector object.

PVector cross(PVector v)

( begin auto-generated from PVector_cross.xml ) Calculates and returns a vector composed of the cross product between two vectors.

PVector cross(PVector v, PVector target)  static PVector cross(PVector v1, PVector v2, PVector target)  float dist(PVector v)

( begin auto-generated from PVector_dist.xml ) Calculates the Euclidean distance between two points (considering a point as a vector object).

static float dist(PVector v1, PVector v2)  PVector div(float n)

( begin auto-generated from PVector_div.xml ) Divides a vector by a scalar or divides one vector by another.

static PVector div(PVector v, float n)

Divide a vector by a scalar and return the result in a new vector.

static PVector div(PVector v, float n, PVector target)

Divide a vector by a scalar and store the result in another vector.

float dot(float x, float y, float z)  float dot(PVector v)

( begin auto-generated from PVector_dot.xml ) Calculates the dot product of two vectors.

static float dot(PVector v1, PVector v2)  boolean equals(java.lang.Object obj)  static PVector fromAngle(float angle)

( begin auto-generated from PVector_sub.xml ) Make a new 2D unit vector from an angle.

static PVector fromAngle(float angle, PVector target)

Make a new 2D unit vector from an angle

PVector get()

Deprecated. 

float[] get(float[] target)  int hashCode()  float heading()

( begin auto-generated from PVector_setMag.xml ) Calculate the angle of rotation for this vector (only 2D vectors) ( end auto-generated )

float heading2D()

Deprecated. 

PVector lerp(float x, float y, float z, float amt)

Linear interpolate the vector to x,y,z values

PVector lerp(PVector v, float amt)

( begin auto-generated from PVector_rotate.xml ) Linear interpolate the vector to another vector ( end auto-generated )

static PVector lerp(PVector v1, PVector v2, float amt)

Linear interpolate between two vectors (returns a new PVector object)

PVector limit(float max)

( begin auto-generated from PVector_limit.xml ) Limit the magnitude of this vector to the value used for the max parameter.

float mag()

( begin auto-generated from PVector_mag.xml ) Calculates the magnitude (length) of the vector and returns the result as a float (this is simply the equation sqrt(x*x + y*y + z*z).) ( end auto-generated )

float magSq()

( begin auto-generated from PVector_mag.xml ) Calculates the squared magnitude of the vector and returns the result as a float (this is simply the equation (x*x + y*y + z*z).) Faster if the real length is not required in the case of comparing vectors, etc.

PVector mult(float n)

( begin auto-generated from PVector_mult.xml ) Multiplies a vector by a scalar or multiplies one vector by another.

static PVector mult(PVector v, float n)  static PVector mult(PVector v, float n, PVector target)

Multiply a vector by a scalar, and write the result into a target PVector.

PVector normalize()

( begin auto-generated from PVector_normalize.xml ) Normalize the vector to length 1 (make it a unit vector).

PVector normalize(PVector target)  static PVector random2D()

( begin auto-generated from PVector_random2D.xml ) Make a new 2D unit vector with a random direction.

static PVector random2D(PApplet parent)

Make a new 2D unit vector with a random direction using Processing's current random number generator

static PVector random2D(PVector target)

Set a 2D vector to a random unit vector with a random direction

static PVector random2D(PVector target, PApplet parent)

Make a new 2D unit vector with a random direction.

static PVector random3D()

( begin auto-generated from PVector_random3D.xml ) Make a new 3D unit vector with a random direction.

static PVector random3D(PApplet parent)

Make a new 3D unit vector with a random direction using Processing's current random number generator

static PVector random3D(PVector target)

Set a 3D vector to a random unit vector with a random direction

static PVector random3D(PVector target, PApplet parent)

Make a new 3D unit vector with a random direction

PVector rotate(float theta)

( begin auto-generated from PVector_rotate.xml ) Rotate the vector by an angle (only 2D vectors), magnitude remains the same ( end auto-generated )

PVector set(float[] source)

Set the x, y (and maybe z) coordinates using a float[] array as the source.

PVector set(float x, float y)  PVector set(float x, float y, float z)

( begin auto-generated from PVector_set.xml ) Sets the x, y, and z component of the vector using two or three separate variables, the data from a PVector, or the values from a float array.

PVector set(PVector v)  PVector setMag(float len)

( begin auto-generated from PVector_setMag.xml ) Set the magnitude of this vector to the value used for the len parameter.

PVector setMag(PVector target, float len)

Sets the magnitude of this vector, storing the result in another vector.

PVector sub(float x, float y)  PVector sub(float x, float y, float z)  PVector sub(PVector v)

( begin auto-generated from PVector_sub.xml ) Subtracts x, y, and z components from a vector, subtracts one vector from another, or subtracts two independent vectors.

static PVector sub(PVector v1, PVector v2)

Subtract one vector from another

static PVector sub(PVector v1, PVector v2, PVector target)

Subtract one vector from another and store in another vector

java.lang.String toString()