PVector class

Constructors

PVector(double x, double y, [double z = 0.0])

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
x double
getter/setter pair
y double
getter/setter pair
z double
getter/setter pair

Methods

add(PVector v) PVector
( begin auto-generated from PVector_add.xml )
copy() PVector
( begin auto-generated from PVector_copy.xml )
dist(PVector v) double
( begin auto-generated from PVector_dist.xml )
div(double n) PVector
( begin auto-generated from PVector_div.xml )
get() PVector
@Deprecated use copy
limit(double max) PVector
( begin auto-generated from PVector_limit.xml )
mag() double
( begin auto-generated from PVector_mag.xml )
magSq() double
( begin auto-generated from PVector_mag.xml )
mult(double n) PVector
( begin auto-generated from PVector_mult.xml )
normalize() PVector
( begin auto-generated from PVector_normalize.xml )
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(double x, double y, double z) PVector
( begin auto-generated from PVector_set.xml )
setMag(double len) PVector
( begin auto-generated from PVector_setMag.xml )
sub(PVector v) PVector
( begin auto-generated from PVector_sub.xml )
toString() String
A string representation of this object.
inherited

Operators

operator +(PVector other) PVector
operator -(PVector other) PVector?
operator ==(Object other) bool
The equality operator.
inherited

Static Methods

add2(PVector v1, PVector v2) PVector
Add two vectors @param v1 a vector @param v2 another vector
add3(PVector v1, PVector v2, PVector? target) PVector
Add two vectors into a target vector @param target the target vector (if null, a new vector will be created)
dist2(PVector v1, PVector v2) double
@param v1 any variable of type PVector @param v2 any variable of type PVector @return the Euclidean distance between v1 and v2
div2(PVector v, double n) PVector?
Divide a vector by a scalar and return the result in a new vector. @param v the vector to divide by the scalar @return a new vector that is v1 / n
div3(PVector v, double n, PVector? target) PVector?
Divide a vector by a scalar and store the result in another vector. @param target PVector in which to store the result
fromAngle(double angle) PVector
( begin auto-generated from PVector_sub.xml )
fromAngle_v2(double angle, PVector? target) PVector
Make a new 2D unit vector from an angle
random2D() PVector
( begin auto-generated from PVector_random2D.xml )
random2D_v2(PVector target) PVector
Set a 2D vector to a random unit vector with a random direction @param target the target vector (if null, a new vector will be created) @return the random PVector
random2D_v3(PVector? target, PApplet? parent) PVector
Make a new 2D unit vector with a random direction. Pass in the parent PApplet if you want randomSeed() to work (and be predictable). Or leave it null and be... random. @return the random PVector
sub2(PVector v1, PVector v2) PVector?
Subtract one vector from another @param v1 the x, y, and z components of a PVector object @param v2 the x, y, and z components of a PVector object
sub3(PVector v1, PVector v2, PVector? target) PVector?
Subtract one vector from another and store in another vector @param target PVector in which to store the result
zero() PVector