Kanzi  3.9.9
Kanzi Engine Java API
Vector4 Class Reference

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

Public Member Functions

 Vector4 ()
 Default constructor, initializes the vector to (0.0, 0.0, 0.0, 0.0).
 
 Vector4 (float v)
 Constructor, initializes the vector to (v, v, v, v). More...
 
 Vector4 (float x, float y, float z, float w)
 Constructor, initializes the vector to (x, y, z, w). More...
 
Vector4 add (float scalar)
 Adds a scalar to each vector element. More...
 
Vector4 add (Vector4 v)
 Modifies this vector by adding another vector. More...
 
synchronized void delete ()
 
Vector4 divide (float scalar)
 Divides each vector element with a scalar. More...
 
boolean equals (Object obj)
 Indicates whether some other object is "equal to" this one. More...
 
float get (int index)
 Returns the vector element value at index. More...
 
float getW ()
 Returns the w element of the vector. More...
 
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...
 
int hashCode ()
 Returns a hash code value for the object. More...
 
boolean hasNan ()
 Returns true if and only if at least one of the vector values is NaN.
 
float length ()
 Calculates the length of the vector. More...
 
Vector4 multiply (float scalar)
 Multiplies each vector element with a scalar. More...
 
Vector4 normalized ()
 Normalizes the vector and returns the resulting vector. More...
 
void set (int index, float value)
 Sets the vector element at index to value. More...
 
void setW (float value)
 Sets the w element of the vector. More...
 
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 of the vector. More...
 
Vector4 subtract (Vector4 v)
 Modifies this vector by subtracting another vector from this vector. More...
 

Static Public Member Functions

static Vector4 add (float scalar, Vector4 v)
 Adds a scalar and a vector and returns the sum. More...
 
static Vector4 add (Vector4 v, float scalar)
 Adds a vector and a scalar and returns the sum. More...
 
static Vector4 add (Vector4 v1, Vector4 v2)
 Adds two vectors and returns the sum. More...
 
static Vector4 componentAbs (Vector4 v)
 Calculates component-wise absolute value for all elements and returns resulting vector. More...
 
static Vector4 componentAdd (Vector4 v, float scalar)
 Adds a value to all elements of a vector and returns the result. More...
 
static boolean componentAllGreaterThan (Vector4 a, Vector4 b)
 Returns whether each component of the first vector is greater than the corresponding component of the second vector. More...
 
static boolean componentAllGreaterThanOrEqual (Vector4 a, Vector4 b)
 Returns whether each component of the first vector is greater than or equal to the corresponding component of the second vector. More...
 
static boolean componentAllLessThan (Vector4 a, Vector4 b)
 Returns whether each component of the first vector is less than the corresponding component of the second vector. More...
 
static boolean componentAllLessThanOrEqual (Vector4 a, Vector4 b)
 Returns whether each component of the first vector is less than or equal to the corresponding component of the second vector. More...
 
static Vector4 componentCeil (Vector4 v)
 Calculates component-wise ceil value for all elements and returns resulting vector. More...
 
static Vector4 componentFloor (Vector4 v)
 Calculates component-wise floor value for all elements and returns resulting vector. More...
 
static Vector4 componentRound (Vector4 v)
 Calculates component-wise rounded value for all elements and returns resulting vector. More...
 
static Vector4 componentSqrt (Vector4 v)
 Calculates component-wise square root all elements and returns resulting vector. More...
 
static Vector4 componentSubtract (Vector4 v, float scalar)
 Subtracts a value from all elements of a vector and returns the result. More...
 
static Vector4 componentWiseDivide (Vector4 v1, Vector4 v2)
 Divides component-wise all vector elements and returns the resulting vector. More...
 
static Vector4 componentWiseMax (Vector4 v1, Vector4 v2)
 Calculates the component-wise maximum for all vector elements and returns the resulting vector. More...
 
static Vector4 componentWiseMin (Vector4 v1, Vector4 v2)
 Calculates the component-wise minimum for all vector elements and returns the resulting vector. More...
 
static Vector4 componentWiseMultiply (Vector4 v1, Vector4 v2)
 Multiplies component-wise all vector elements and returns the resulting vector. More...
 
static Vector4 componentWiseRemainder (Vector4 v1, Vector4 v2)
 Calculates component-wise the remainder for all vector elements and returns the resulting vector. More...
 
static Vector4 divide (Vector4 v, float scalar)
 Divides all vector elements with a scalar and returns the resulting vector. More...
 
static float dotProduct (Vector4 v1, Vector4 v2)
 Calculates the dot product of two vectors. More...
 
static Vector4 highestValue ()
 Returns the vector with each element having the most positive float value. More...
 
static Vector4 linearTosRGB (Vector4 vec)
 Conversion to whole Vector4 from linear to sRGB. More...
 
static Vector4 lowestValue ()
 Returns the vector with each element having the most negative float value. More...
 
static Vector4 multiply (float scalar, Vector4 v)
 Multiplies all vector elements with a scalar and returns the resulting vector. More...
 
static Vector4 multiply (Vector4 v, float scalar)
 Multiplies all vector elements with a scalar and returns the resulting vector. More...
 
static Vector4 nan ()
 Returns the vector with each element being NaN. More...
 
static Vector4 negate (Vector4 v)
 Negates all vector elements and returns the resulting vector. More...
 
static Vector4 negativeInfinity ()
 Returns the vector with each element being the negative infinity. More...
 
static Vector4 one ()
 Returns the vector with each element being one. More...
 
static Vector4 positiveInfinity ()
 Returns the vector with each element being the positive infinity. More...
 
static Vector4 sRGBToLinear (Vector4 vec)
 Conversion to whole Vector4 from sRGB to linear. More...
 
static Vector4 subtract (Vector4 v1, Vector4 v2)
 Subtracts two vectors and returns the difference. More...
 
static Vector4 zero ()
 Returns the vector with each element being zero. More...
 

Protected Member Functions

void finalize ()
 Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. More...
 

Protected Attributes

transient boolean swigCMemOwn
 Does this object own its native object. More...
 

Detailed Description

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

Constructor & Destructor Documentation

Vector4 ( float  v)

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


Parameters
vx, y, z, and w component of the vector.
Vector4 ( float  x,
float  y,
float  z,
float  w 
)

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


Parameters
xx component of the vector.
yy component of the vector.
zz component of the vector.
ww component of the vector.

Member Function Documentation

Vector4 add ( float  scalar)

Adds a scalar to each vector element.


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

Modifies this vector by adding another vector.


Parameters
vAnother vector.
Returns
This vector.
static Vector4 add ( float  scalar,
Vector4  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 Vector4 add ( Vector4  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 Vector4 add ( Vector4  v1,
Vector4  v2 
)
static

Adds two vectors and returns the sum.

Parameters
v1Left hand side vector.
v2Right hand side vector.
Returns
The result vector.
static Vector4 componentAbs ( Vector4  v)
static

Calculates component-wise absolute value for all elements and returns resulting vector.


Parameters
vVector input.
Returns
The result vector.
static Vector4 componentAdd ( Vector4  v,
float  scalar 
)
static

Adds a value to all elements of a vector and returns the result.


Parameters
vA vector.
scalarA scalar.
Returns
The result vector.
static boolean componentAllGreaterThan ( Vector4  a,
Vector4  b 
)
static

Returns whether each component of the first vector is greater than the corresponding component of the second vector.


Parameters
aFirst vector.
bSecond vector.
Returns
If each component of the first vector is greater than the corresponding component of the second vector, true, otherwise false.
static boolean componentAllGreaterThanOrEqual ( Vector4  a,
Vector4  b 
)
static

Returns whether each component of the first vector is greater than or equal to the corresponding component of the second vector.


Parameters
aFirst vector.
bSecond vector.
Returns
If each component of the first vector is greater than or equal to the corresponding component of the second vector, true, otherwise false.
static boolean componentAllLessThan ( Vector4  a,
Vector4  b 
)
static

Returns whether each component of the first vector is less than the corresponding component of the second vector.


Parameters
aFirst vector.
bSecond vector.
Returns
If each component of the first vector is less than the corresponding component of the second vector, true, otherwise false.
static boolean componentAllLessThanOrEqual ( Vector4  a,
Vector4  b 
)
static

Returns whether each component of the first vector is less than or equal to the corresponding component of the second vector.


Parameters
aFirst vector.
bSecond vector.
Returns
If each component of the first vector is less than or equal to the corresponding component of the second vector, true, othwerise false.
static Vector4 componentCeil ( Vector4  v)
static

Calculates component-wise ceil value for all elements and returns resulting vector.


Parameters
vVector input.
Returns
The result vector.
static Vector4 componentFloor ( Vector4  v)
static

Calculates component-wise floor value for all elements and returns resulting vector.


Parameters
vVector input.
Returns
The result vector.
static Vector4 componentRound ( Vector4  v)
static

Calculates component-wise rounded value for all elements and returns resulting vector.


Parameters
vVector input.
Returns
The result vector.
static Vector4 componentSqrt ( Vector4  v)
static

Calculates component-wise square root all elements and returns resulting vector.


Parameters
vVector input.
Returns
The result vector.
static Vector4 componentSubtract ( Vector4  v,
float  scalar 
)
static

Subtracts a value from all elements of a vector and returns the result.


Parameters
vA vector.
scalarA scalar.
Returns
The result vector.
static Vector4 componentWiseDivide ( Vector4  v1,
Vector4  v2 
)
static

Divides component-wise all vector elements and returns the resulting vector.


Parameters
v1The first vector.
v2The second vector.
Returns
The result vector.
static Vector4 componentWiseMax ( Vector4  v1,
Vector4  v2 
)
static

Calculates the component-wise maximum for all vector elements and returns the resulting vector.


Parameters
v1The first vector.
v2The second vector.
Returns
The result vector.
static Vector4 componentWiseMin ( Vector4  v1,
Vector4  v2 
)
static

Calculates the component-wise minimum for all vector elements and returns the resulting vector.


Parameters
v1The first vector.
v2The second vector.
Returns
The result vector.
static Vector4 componentWiseMultiply ( Vector4  v1,
Vector4  v2 
)
static

Multiplies component-wise all vector elements and returns the resulting vector.


Parameters
v1The first vector.
v2The second vector.
Returns
The result vector.
static Vector4 componentWiseRemainder ( Vector4  v1,
Vector4  v2 
)
static

Calculates component-wise the remainder for all vector elements and returns the resulting vector.


Parameters
v1The first vector.
v2The second vector.
Returns
The result vector.
Vector4 divide ( float  scalar)

Divides each vector element with a scalar.


Parameters
scalarDivider for each vector element.
Returns
This vector.
static Vector4 divide ( Vector4  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.
static float dotProduct ( Vector4  v1,
Vector4  v2 
)
static

Calculates the dot product of two vectors.


Parameters
v1The first vector.
v2The second vector.
Returns
The dot product of the vectors.
boolean equals ( Object  obj)

Indicates whether some other object is "equal to" this one.

Parameters
objThe reference object with which to compare.
Returns
True if this object is the same as the obj argument, otherwise false.
void finalize ( )
protected

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

Finalization is deprecated and subject to removal in future.

float get ( int  index)

Returns the vector element value at index.


Returns
The vector element value at index.
float getW ( )

Returns the w element of the vector.


Returns
The w element.
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.
int hashCode ( )

Returns a hash code value for the object.

Returns
A hash code value for this object.
static Vector4 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 of the vector.


Returns
sqrt(dot product of the vector).
static Vector4 linearTosRGB ( Vector4  vec)
static

Conversion to whole Vector4 from linear to sRGB.


Parameters
vecVector4 representing color in linear format.
Returns
Vector4 representing color in sRGB format.
static Vector4 lowestValue ( )
static

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


Returns
Vector with the lowest possible value.
Vector4 multiply ( float  scalar)

Multiplies each vector element with a scalar.


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

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

Parameters
scalarA scalar.
vA vector.
Returns
The result vector.
static Vector4 multiply ( Vector4  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 Vector4 nan ( )
static

Returns the vector with each element being NaN.


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

Negates all vector elements and returns the resulting vector.

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

Returns the vector with each element being the negative infinity.


Returns
Vector with negative infinity elements.
Vector4 normalized ( )

Normalizes the vector and returns the resulting vector.


Returns
The normalized vector.
static Vector4 one ( )
static

Returns the vector with each element being one.


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

Returns the vector with each element being the positive infinity.


Returns
Vector with positive infinity elements.
void set ( int  index,
float  value 
)

Sets the vector element at index to value.


Parameters
indexVector element index to set.
valueValue to set.
void setW ( float  value)

Sets the w element of the vector.


Parameters
valueThe new value of the w element.
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 of the vector.


Returns
Dot product of the vector.
static Vector4 sRGBToLinear ( Vector4  vec)
static

Conversion to whole Vector4 from sRGB to linear.


Parameters
vecVector4 representing color in sRGB format.
Returns
Vector4 representing color in linear format.
Vector4 subtract ( Vector4  v)

Modifies this vector by subtracting another vector from this vector.


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

Subtracts two vectors and returns the difference.

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

Returns the vector with each element being zero.


Returns
Vector with zeroed elements.

Member Data Documentation

transient boolean swigCMemOwn
protected

Does this object own its native object.