Public Member Functions | |
Vector () | |
Vector (double x, double y, double z) | |
Vector (Vector v) | |
Vector | add (Vector v) |
Vector | sub (Vector v) |
Vector | div (double s) |
Vector | mult (double s) |
double | mag () |
Vector | norm () |
int | hashCode () |
boolean | equals (Object obj) |
String | toString () |
Static Public Member Functions | |
static Vector | add (Vector v1, Vector v2) |
static Vector | sub (Vector v1, Vector v2) |
static Vector | mult (Vector v1, Vector v2) |
static Vector | mult (Vector v1, double s) |
static Vector | div (Vector v1, double s) |
static double | dot (Vector v1, Vector v2) |
static Vector | cross (Vector v1, Vector v2) |
static Vector | lerp (Vector v1, Vector v2, double t) |
static double | angleBetween (Vector origin, Vector v1, Vector v2) |
Public Attributes | |
final double | x |
final double | y |
final double | z |
Static Public Attributes | |
static Vector | ZERO_VECTOR = new Vector() |
static Vector | X_VECTOR = new Vector(1,0,0) |
static Vector | Y_VECTOR = new Vector(0,1,0) |
static Vector | Z_VECTOR = new Vector(0,0,1) |
org.qscript.Vector.Vector | ( | ) |
Create the zero vector [0,0,0]
org.qscript.Vector.Vector | ( | double | x, |
double | y, | ||
double | z | ||
) |
Create the vector [x,y,z]
org.qscript.Vector.Vector | ( | Vector | v | ) |
Create a copy of the vector v
Get the angle between two vectors in radians. If either vector is of size 0 (zero) then it returns zero.
The cross product between v1 and v2
Vector org.qscript.Vector.div | ( | double | s | ) |
this vector / scalar
The dot product between v1 and v2
boolean org.qscript.Vector.equals | ( | Object | obj | ) |
Compare 2 vectors for equality
int org.qscript.Vector.hashCode | ( | ) |
Calculate the hashcode based on all 3 coordinate values
Linear interpretation between 2 vectors. The parametric variable will be in the range >=0 and <=1
double org.qscript.Vector.mag | ( | ) |
the magnitude (size) of this vector
Vector org.qscript.Vector.mult | ( | double | s | ) |
this vector * scalar
Vector org.qscript.Vector.norm | ( | ) |
the normalized version of this vector