Kanzi  3.9.5
Java API
Vector4 Class Reference

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

Public Member Functions

 Vector4 (long cPtr, boolean cMemoryOwn)
 
 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)
 
float get (long 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 ()
 
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 (long 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 long getCPtr (Vector4 obj)
 
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 ()
 

Protected Attributes

transient boolean swigCMemOwn
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Vector4() [1/2]

Vector4 ( float  v)

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


Parameters
vx, y, z, and w component of the vector.

◆ Vector4() [2/2]

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

◆ add() [1/5]

Vector4 add ( float  scalar)

Adds a scalar to each vector element.


Parameters
scalarAddition to each vector element.
Returns
This vector.

◆ add() [2/5]

Vector4 add ( Vector4  v)

Modifies this vector by adding another vector.


Parameters
vAnother vector.
Returns
This vector.

◆ add() [3/5]

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.

◆ add() [4/5]

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.

◆ add() [5/5]

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.

◆ componentAbs()

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.

◆ componentAdd()

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.

◆ componentAllGreaterThan()

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.

◆ componentAllGreaterThanOrEqual()

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.

◆ componentAllLessThan()

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.

◆ componentAllLessThanOrEqual()

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.

◆ componentCeil()

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.

◆ componentFloor()

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.

◆ componentRound()

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.

◆ componentSqrt()

static Vector4 componentSqrt ( Vector4  v)
static

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


Parameters
vVector input.
Returns
The result vector.

◆ componentSubtract()

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.

◆ componentWiseDivide()

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.

◆ componentWiseMax()

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.

◆ componentWiseMin()

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.

◆ componentWiseMultiply()

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.

◆ componentWiseRemainder()

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.

◆ divide() [1/2]

Vector4 divide ( float  scalar)

Divides each vector element with a scalar.


Parameters
scalarDivider for each vector element.
Returns
This vector.

◆ divide() [2/2]

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.

◆ dotProduct()

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.

◆ get()

float get ( long  index)

Returns the vector element value at index.


Returns
The vector element value at index.

◆ getW()

float getW ( )

Returns the w element of the vector.


Returns
The w element.

◆ getX()

float getX ( )

Returns the x element of the vector.


Returns
The x element.

◆ getY()

float getY ( )

Returns the y element of the vector.


Returns
The y element.

◆ getZ()

float getZ ( )

Returns the z element of the vector.


Returns
The z element.

◆ highestValue()

static Vector4 highestValue ( )
static

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


Returns
Vector with the highest possible value.

◆ length()

float length ( )

Calculates the length of the vector.


Returns
sqrt(dot product of the vector).

◆ linearTosRGB()

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.

◆ lowestValue()

static Vector4 lowestValue ( )
static

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


Returns
Vector with the lowest possible value.

◆ multiply() [1/3]

Vector4 multiply ( float  scalar)

Multiplies each vector element with a scalar.


Parameters
scalarMultiplier for each vector element.
Returns
This vector.

◆ multiply() [2/3]

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.

◆ multiply() [3/3]

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.

◆ nan()

static Vector4 nan ( )
static

Returns the vector with each element being NaN.


Returns
Vector with NaN elements.

◆ negate()

static Vector4 negate ( Vector4  v)
static

Negates all vector elements and returns the resulting vector.

Parameters
vA vector.
Returns
The result vector.

◆ negativeInfinity()

static Vector4 negativeInfinity ( )
static

Returns the vector with each element being the negative infinity.


Returns
Vector with negative infinity elements.

◆ normalized()

Vector4 normalized ( )

Normalizes the vector and returns the resulting vector.


Returns
The normalized vector.

◆ one()

static Vector4 one ( )
static

Returns the vector with each element being one.


Returns
Vector with unit element values.

◆ positiveInfinity()

static Vector4 positiveInfinity ( )
static

Returns the vector with each element being the positive infinity.


Returns
Vector with positive infinity elements.

◆ set()

void set ( long  index,
float  value 
)

Sets the vector element at index to value.


Parameters
indexVector element index to set.
valueValue to set.

◆ setW()

void setW ( float  value)

Sets the w element of the vector.


Parameters
valueThe new value of the w element.

◆ setX()

void setX ( float  value)

Sets the x element of the vector.


Parameters
valueThe new value of the x element.

◆ setY()

void setY ( float  value)

Sets the y element of the vector.


Parameters
valueThe new value of the y element.

◆ setZ()

void setZ ( float  value)

Sets the z element of the vector.


Parameters
valueThe new value of the z element.

◆ squaredLength()

float squaredLength ( )

Calculates the squared length of the vector.


Returns
Dot product of the vector.

◆ sRGBToLinear()

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.

◆ subtract() [1/2]

Vector4 subtract ( Vector4  v)

Modifies this vector by subtracting another vector from this vector.


Parameters
vAnother vector.
Returns
This vector.

◆ subtract() [2/2]

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.

◆ zero()

static Vector4 zero ( )
static

Returns the vector with each element being zero.


Returns
Vector with zeroed elements.