QScript  2.1.2
Expression and algorithm evaluator
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
org.qscript.Vector Class Reference

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)
 

Detailed Description

Immutable representation of a Vector. So all methods return a new Vector object.

Author
Peter Lager

Constructor & Destructor Documentation

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

Member Function Documentation

static Vector org.qscript.Vector.add ( Vector  v1,
Vector  v2 
)
static

v1 + v2

Vector org.qscript.Vector.add ( Vector  v)

this vector + v

static double org.qscript.Vector.angleBetween ( Vector  origin,
Vector  v1,
Vector  v2 
)
static

Get the angle between two vectors in radians. If either vector is of size 0 (zero) then it returns zero.

static Vector org.qscript.Vector.cross ( Vector  v1,
Vector  v2 
)
static

The cross product between v1 and v2

static Vector org.qscript.Vector.div ( Vector  v1,
double  s 
)
static

v1 / scalar

Vector org.qscript.Vector.div ( double  s)

this vector / scalar

static double org.qscript.Vector.dot ( Vector  v1,
Vector  v2 
)
static

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

static Vector org.qscript.Vector.lerp ( Vector  v1,
Vector  v2,
double  t 
)
static

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

static Vector org.qscript.Vector.mult ( Vector  v1,
Vector  v2 
)
static

v1 * v2

static Vector org.qscript.Vector.mult ( Vector  v1,
double  s 
)
static

v1 * scalar

Vector org.qscript.Vector.mult ( double  s)

this vector * scalar

Vector org.qscript.Vector.norm ( )

the normalized version of this vector

static Vector org.qscript.Vector.sub ( Vector  v1,
Vector  v2 
)
static

v1 - v2

Vector org.qscript.Vector.sub ( Vector  v)

this vector - v


The documentation for this class was generated from the following file: