Kanzi Java API
Vector3 Class Reference

Vector with 3 floating point components: (x, y, z). More...

Public Member Functions

 Vector3 (long cPtr, boolean cMemoryOwn)
 
 Vector3 ()
 Default constructor, initializes the vector to (0.0, 0.0, 0.0).
 
 Vector3 (float x, float y, float z)
 Constructor, initializes the vector to (x, y, z). More...
 
 Vector3 (float v)
 Constructor, initializes the vector to (v, v, v). More...
 
Vector3 add (float scalar)
 Adds a scalar to each vector element. More...
 
Vector3 add (Vector3 v)
 Modifies this vector by adding another vector. More...
 
synchronized void delete ()
 
Vector3 divide (float scalar)
 Divides each vector element with a scalar. More...
 
boolean equals (Object obj)
 
float get (long index)
 
float getX ()
 Returns the x element of the vector. More...
 
float getY ()
 Returns the y element of the vector. More...
 
float getZ ()
 Returns the z element of the vector. More...
 
boolean hasNan ()
 Returns true if and only if at least one of the vector values is NaN.
 
float length ()
 Calculates the length a vectors. More...
 
Vector3 maximumAxis ()
 Returns axis based on the largest component of Vector3. More...
 
Vector3 minimumAxis ()
 Returns axis based on the minimum component of Vector3. More...
 
Vector3 multiply (float scalar)
 Multiplies each vector element with a scalar. More...
 
Vector3 normalized ()
 Normalizes the vector and returns the resulting vector. More...
 
void set (long index, float value)
 
void setX (float value)
 Sets the x element of the vector. More...
 
void setY (float value)
 Sets the y element of the vector. More...
 
void setZ (float value)
 Sets the z element of the vector. More...
 
float squaredLength ()
 Calculates the squared length a vectors. More...
 
Vector3 subtract (Vector3 v)
 Modifies this vector by subtracting another vector from this vector. More...
 

Static Public Member Functions

static Vector3 add (float scalar, Vector3 v)
 Adds a scalar and a vector and returns the sum. More...
 
static Vector3 add (Vector3 v, float scalar)
 Adds a vector and a scalar and returns the sum. More...
 
static Vector3 add (Vector3 v1, Vector3 v2)
 Adds two vectors and returns the sum. More...
 
static Vector3 componentAbs (Vector3 v)
 
static Vector3 componentAdd (Vector3 v, float scalar)
 
static boolean componentAllGreaterThan (Vector3 a, Vector3 b)
 
static boolean componentAllGreaterThanOrEqual (Vector3 a, Vector3 b)
 
static boolean componentAllLessThan (Vector3 a, Vector3 b)
 
static boolean componentAllLessThanOrEqual (Vector3 a, Vector3 b)
 
static Vector3 componentCeil (Vector3 v)
 
static Vector3 componentFloor (Vector3 v)
 
static Vector3 componentRound (Vector3 v)
 
static Vector3 componentSqrt (Vector3 v)
 
static Vector3 componentSubtract (Vector3 v, float scalar)
 
static Vector3 componentWiseDivide (Vector3 v1, Vector3 v2)
 
static Vector3 componentWiseMax (Vector3 v1, Vector3 v2)
 
static Vector3 componentWiseMin (Vector3 v1, Vector3 v2)
 
static Vector3 componentWiseMultiply (Vector3 v1, Vector3 v2)
 
static Vector3 componentWiseRemainder (Vector3 v1, Vector3 v2)
 
static Vector3 crossProduct (Vector3 v1, Vector3 v2)
 
static Vector3 divide (Vector3 v, float scalar)
 Divides all vector elements with a scalar and returns the resulting vector. More...
 
static float dotProduct (Vector3 v1, Vector3 v2)
 
static long getCPtr (Vector3 obj)
 
static Vector3 getOrthogonalVector (Vector3 v)
 
static Vector3 highestValue ()
 Returns the vector with each element having the most positive float value. More...
 
static Vector3 linearTosRGB (Vector3 vec)
 
static Vector3 lowestValue ()
 Returns the vector with each element having the most negative float value. More...
 
static Vector3 multiply (float scalar, Vector3 v)
 Multiplies all vector elements with a scalar and returns the resulting vector. More...
 
static Vector3 multiply (Vector3 v, float scalar)
 Multiplies all vector elements with a scalar and returns the resulting vector. More...
 
static Vector3 nan ()
 Returns the vector with each element being NaN. More...
 
static Vector3 negate (Vector3 v)
 Negates all vector elements and returns the resulting vector. More...
 
static Vector3 negativeInfinity ()
 Returns the vector with each element being the negative infinity. More...
 
static Vector3 negativeX ()
 Returns the unit vector pointing left. More...
 
static Vector3 negativeY ()
 Returns the unit vector pointing down. More...
 
static Vector3 negativeZ ()
 Returns the unit vector pointing forward. More...
 
static Vector3 one ()
 Returns the vector with each element being one. More...
 
static Vector3 positiveInfinity ()
 Returns the vector with each element being the positive infinity. More...
 
static Vector3 positiveX ()
 Returns the unit vector pointing right. More...
 
static Vector3 positiveY ()
 Returns the unit vector pointing up. More...
 
static Vector3 positiveZ ()
 Returns the unit vector pointing backward. More...
 
static Vector3 sRGBToLinear (Vector3 vec)
 
static Vector3 subtract (Vector3 v1, Vector3 v2)
 Subtracts two vectors and returns the difference. More...
 
static Vector3 zero ()
 Returns the vector with each element being zero. More...
 

Protected Member Functions

void finalize ()
 

Protected Attributes

transient boolean swigCMemOwn
 

Detailed Description

Vector with 3 floating point components: (x, y, z).

Constructor & Destructor Documentation

Vector3 ( float  x,
float  y,
float  z 
)

Constructor, initializes the vector to (x, y, z).


Parameters
xx component of the vector.
yy component of the vector.
zz component of the vector.
Vector3 ( float  v)

Constructor, initializes the vector to (v, v, v).


Parameters
vx, y and z components of the vector.

Member Function Documentation

Vector3 add ( float  scalar)

Adds a scalar to each vector element.


Parameters
scalarAddition to each vector element.
Returns
This vector.
Vector3 add ( Vector3  v)

Modifies this vector by adding another vector.


Parameters
vAnother vector.
Returns
This vector.
static Vector3 add ( float  scalar,
Vector3  v 
)
static

Adds a scalar and a vector and returns the sum.

Parameters
scalarLeft hand side scalar.
vRight hand side vector.
Returns
The result vector.
static Vector3 add ( Vector3  v,
float  scalar 
)
static

Adds a vector and a scalar and returns the sum.

Parameters
vLeft hand side vector.
scalarRight hand side scalar.
Returns
The result vector.
static Vector3 add ( Vector3  v1,
Vector3  v2 
)
static

Adds two vectors and returns the sum.

Parameters
v1Left hand side vector.
v2Right hand side vector.
Returns
The result vector.
Vector3 divide ( float  scalar)

Divides each vector element with a scalar.


Parameters
scalarDivider for each vector element.
Returns
This vector.
static Vector3 divide ( Vector3  v,
float  scalar 
)
static

Divides all vector elements with a scalar and returns the resulting vector.

Parameters
vA vector.
scalarA scalar.
Returns
The result vector.
float getX ( )

Returns the x element of the vector.


Returns
The x element.
float getY ( )

Returns the y element of the vector.


Returns
The y element.
float getZ ( )

Returns the z element of the vector.


Returns
The z element.
static Vector3 highestValue ( )
static

Returns the vector with each element having the most positive float value.


Returns
Vector with the highest possible value.
float length ( )

Calculates the length a vectors.


Returns
sqrt(x*x + y*y + z*z)
static Vector3 lowestValue ( )
static

Returns the vector with each element having the most negative float value.


Returns
Vector with the lowest possible value.
Vector3 maximumAxis ( )

Returns axis based on the largest component of Vector3.


Returns
If X component is largest, (1, 0, 0), else if Y component is largest, (0, 1, 0), else (0, 0, 1).
Vector3 minimumAxis ( )

Returns axis based on the minimum component of Vector3.


Returns
If X component is smallest, (1, 0, 0), else if Y component is smallest, (0, 1, 0), else (0, 0, 1).
Vector3 multiply ( float  scalar)

Multiplies each vector element with a scalar.


Parameters
scalarMultiplier for each vector element.
Returns
This vector.
static Vector3 multiply ( float  scalar,
Vector3  v 
)
static

Multiplies all vector elements with a scalar and returns the resulting vector.

Parameters
scalarA scalar.
vA vector.
Returns
The result vector.
static Vector3 multiply ( Vector3  v,
float  scalar 
)
static

Multiplies all vector elements with a scalar and returns the resulting vector.

Parameters
vA vector.
scalarA scalar.
Returns
The result vector.
static Vector3 nan ( )
static

Returns the vector with each element being NaN.


Returns
Vector with NaN elements.
static Vector3 negate ( Vector3  v)
static

Negates all vector elements and returns the resulting vector.

Parameters
vA vector.
Returns
The result vector.
static Vector3 negativeInfinity ( )
static

Returns the vector with each element being the negative infinity.


Returns
Vector with negative infinity elements.
static Vector3 negativeX ( )
static

Returns the unit vector pointing left.


Returns
Vector3(-1.0f, 0.0f, 0.0f).
static Vector3 negativeY ( )
static

Returns the unit vector pointing down.


Returns
Vector3(0.0f, -1.0f, 0.0f).
static Vector3 negativeZ ( )
static

Returns the unit vector pointing forward.


Returns
Vector3(0.0f, 0.0f, -1.0f).
Vector3 normalized ( )

Normalizes the vector and returns the resulting vector.


Returns
The normalized vector.
static Vector3 one ( )
static

Returns the vector with each element being one.


Returns
Vector with unit element values.
static Vector3 positiveInfinity ( )
static

Returns the vector with each element being the positive infinity.


Returns
Vector with positive infinity elements.
static Vector3 positiveX ( )
static

Returns the unit vector pointing right.


Returns
Vector3(1.0f, 0.0f, 0.0f).
static Vector3 positiveY ( )
static

Returns the unit vector pointing up.


Returns
Vector3(0.0f, 1.0f, 0.0f).
static Vector3 positiveZ ( )
static

Returns the unit vector pointing backward.


Returns
Vector3(0.0f, 0.0f, 1.0f).
void setX ( float  value)

Sets the x element of the vector.


Parameters
valueThe new value of the x element.
void setY ( float  value)

Sets the y element of the vector.


Parameters
valueThe new value of the y element.
void setZ ( float  value)

Sets the z element of the vector.


Parameters
valueThe new value of the z element.
float squaredLength ( )

Calculates the squared length a vectors.


Returns
x*x + y*y + z*z
Vector3 subtract ( Vector3  v)

Modifies this vector by subtracting another vector from this vector.


Parameters
vAnother vector.
Returns
This vector.
static Vector3 subtract ( Vector3  v1,
Vector3  v2 
)
static

Subtracts two vectors and returns the difference.

Parameters
v1Left hand side vector.
v2Right hand side vector.
Returns
The result vector.
static Vector3 zero ( )
static

Returns the vector with each element being zero.


Returns
Vector with zeroed elements.