JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.math.Vec4f Class Reference

4D Vector based upon four float components. More...

Collaboration diagram for com.jogamp.math.Vec4f:

Public Member Functions

 Vec4f ()
 
 Vec4f (final Vec4f o)
 
 Vec4f (final Vec3f o, final float w)
 Creating new Vec4f using { o, w }. More...
 
Vec4f copy ()
 
 Vec4f (final float[] xyzw)
 
 Vec4f (final float x, final float y, final float z, final float w)
 
Vec4f set (final Vec4f o)
 this = o, returns this. More...
 
Vec4f set (final Vec3f o, final float w)
 this = { o, w }, returns this. More...
 
Vec4f set (final float x, final float y, final float z, final float w)
 this = { x, y, z, w }, returns this. More...
 
Vec4f set (final float[] xyzw)
 this = xyzw, returns this. More...
 
Vec4f toArray (final float[] xyzw)
 xyzw[0..3] = this. More...
 
void set (final int i, final float val)
 Sets the ith component, 0 <= i < 4. More...
 
float[] get (final float[] xyzw)
 xyzw = this, returns xyzw. More...
 
float get (final int i)
 Gets the ith component, 0 <= i < 4. More...
 
float x ()
 
float y ()
 
float z ()
 
float w ()
 
void setX (final float x)
 
void setY (final float y)
 
void setZ (final float z)
 
void setW (final float w)
 
Vec4f max (final Vec4f m)
 this = max(this, m), returns this. More...
 
Vec4f min (final Vec4f m)
 this = min(this, m), returns this. More...
 
Vec4f mul (final float val)
 Returns this * val; creates new vector. More...
 
Vec4f mul (final Vec4f a, final Vec4f b)
 this = a * b, returns this. More...
 
Vec4f mul (final Vec4f s)
 this = this * s, returns this. More...
 
Vec4f mul (final float sx, final float sy, final float sz, final float sw)
 this = this * { sx, sy, sz, sw }, returns this. More...
 
Vec4f div (final Vec4f a, final Vec4f b)
 this = a / b, returns this. More...
 
Vec4f div (final Vec4f a)
 this = this / a, returns this. More...
 
Vec4f scale (final float s)
 this = this * s, returns this. More...
 
Vec4f plus (final Vec4f arg)
 Returns this + arg; creates new vector. More...
 
Vec4f plus (final Vec4f a, final Vec4f b)
 this = a + b, returns this. More...
 
Vec4f add (final float dx, final float dy, final float dz, final float dw)
 this = this + { dx, dy, dz, dw }, returns this. More...
 
Vec4f add (final Vec4f b)
 this = this + b, returns this. More...
 
Vec4f minus (final Vec4f arg)
 Returns this - arg; creates new vector. More...
 
Vec4f minus (final Vec4f a, final Vec4f b)
 this = a - b, returns this. More...
 
Vec4f sub (final Vec4f b)
 this = this - b, returns this. More...
 
boolean isZero ()
 Return true if all components are zero, i.e. More...
 
float length ()
 Return the length of this vector, a.k.a the norm or magnitude More...
 
float lengthSq ()
 Return the squared length of this vector, a.k.a the squared norm or squared magnitude More...
 
Vec4f normalize ()
 Normalize this vector in place. More...
 
float distSq (final Vec4f o)
 Return the squared distance between this vector and the given one. More...
 
float dist (final Vec4f o)
 Return the distance between this vector and the given one. More...
 
float dot (final Vec4f o)
 Return the dot product of this vector and the given one. More...
 
float cosAngle (final Vec4f o)
 Return the cosines of the angle between two vectors. More...
 
float angle (final Vec4f o)
 Return the angle between two vectors in radians. More...
 
boolean isEqual (final Vec4f o, final float epsilon)
 Equals check using a given FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float). More...
 
boolean isEqual (final Vec4f o)
 Equals check using FloatUtil#EPSILON in FloatUtil#isEqual(float, float). More...
 
boolean equals (final Object o)
 
String toString ()
 

Detailed Description

4D Vector based upon four float components.

Implementation borrowed from gfxbox2 and its data layout from JOAL's Vec3f.

Definition at line 37 of file Vec4f.java.

Constructor & Destructor Documentation

◆ Vec4f() [1/5]

com.jogamp.math.Vec4f.Vec4f ( )

Definition at line 43 of file Vec4f.java.

Here is the caller graph for this function:

◆ Vec4f() [2/5]

com.jogamp.math.Vec4f.Vec4f ( final Vec4f  o)

Definition at line 45 of file Vec4f.java.

◆ Vec4f() [3/5]

com.jogamp.math.Vec4f.Vec4f ( final Vec3f  o,
final float  w 
)

Creating new Vec4f using { o, w }.

Definition at line 50 of file Vec4f.java.

◆ Vec4f() [4/5]

com.jogamp.math.Vec4f.Vec4f ( final float[]  xyzw)

Definition at line 58 of file Vec4f.java.

◆ Vec4f() [5/5]

com.jogamp.math.Vec4f.Vec4f ( final float  x,
final float  y,
final float  z,
final float  w 
)

Definition at line 62 of file Vec4f.java.

Member Function Documentation

◆ add() [1/2]

Vec4f com.jogamp.math.Vec4f.add ( final float  dx,
final float  dy,
final float  dz,
final float  dw 
)

this = this + { dx, dy, dz, dw }, returns this.

Definition at line 237 of file Vec4f.java.

Here is the caller graph for this function:

◆ add() [2/2]

Vec4f com.jogamp.math.Vec4f.add ( final Vec4f  b)

this = this + b, returns this.

Definition at line 246 of file Vec4f.java.

◆ angle()

float com.jogamp.math.Vec4f.angle ( final Vec4f  o)

Return the angle between two vectors in radians.

Definition at line 357 of file Vec4f.java.

Here is the call graph for this function:

◆ copy()

Vec4f com.jogamp.math.Vec4f.copy ( )

Definition at line 54 of file Vec4f.java.

Here is the call graph for this function:

◆ cosAngle()

float com.jogamp.math.Vec4f.cosAngle ( final Vec4f  o)

Return the cosines of the angle between two vectors.

Definition at line 350 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dist()

float com.jogamp.math.Vec4f.dist ( final Vec4f  o)

Return the distance between this vector and the given one.

Definition at line 334 of file Vec4f.java.

Here is the call graph for this function:

◆ distSq()

float com.jogamp.math.Vec4f.distSq ( final Vec4f  o)

Return the squared distance between this vector and the given one.

When comparing the relative distance between two points it is usually sufficient to compare the squared distances, thus avoiding an expensive square root operation.

Definition at line 323 of file Vec4f.java.

Here is the caller graph for this function:

◆ div() [1/2]

Vec4f com.jogamp.math.Vec4f.div ( final Vec4f  a)

this = this / a, returns this.

Definition at line 205 of file Vec4f.java.

◆ div() [2/2]

Vec4f com.jogamp.math.Vec4f.div ( final Vec4f  a,
final Vec4f  b 
)

this = a / b, returns this.

Definition at line 196 of file Vec4f.java.

◆ dot()

float com.jogamp.math.Vec4f.dot ( final Vec4f  o)

Return the dot product of this vector and the given one.

Returns
the dot product as float

Definition at line 343 of file Vec4f.java.

Here is the caller graph for this function:

◆ equals()

boolean com.jogamp.math.Vec4f.equals ( final Object  o)

Definition at line 409 of file Vec4f.java.

Here is the call graph for this function:

◆ get() [1/2]

float[] com.jogamp.math.Vec4f.get ( final float[]  xyzw)

xyzw = this, returns xyzw.

Definition at line 123 of file Vec4f.java.

Here is the caller graph for this function:

◆ get() [2/2]

float com.jogamp.math.Vec4f.get ( final int  i)

Gets the ith component, 0 <= i < 4.

Definition at line 132 of file Vec4f.java.

◆ isEqual() [1/2]

boolean com.jogamp.math.Vec4f.isEqual ( final Vec4f  o)

Equals check using FloatUtil#EPSILON in FloatUtil#isEqual(float, float).

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Parameters
ocomparison value
Returns
true if all components differ less than FloatUtil#EPSILON, otherwise false.

Definition at line 397 of file Vec4f.java.

Here is the call graph for this function:

◆ isEqual() [2/2]

boolean com.jogamp.math.Vec4f.isEqual ( final Vec4f  o,
final float  epsilon 
)

Equals check using a given FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float).

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Parameters
ocomparison value
epsilonconsider using FloatUtil#EPSILON
Returns
true if all components differ less than epsilon, otherwise false.

Definition at line 374 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isZero()

boolean com.jogamp.math.Vec4f.isZero ( )

Return true if all components are zero, i.e.

it's absolute value < EPSILON.

Definition at line 278 of file Vec4f.java.

Here is the call graph for this function:

◆ length()

float com.jogamp.math.Vec4f.length ( )

Return the length of this vector, a.k.a the norm or magnitude

Definition at line 285 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lengthSq()

float com.jogamp.math.Vec4f.lengthSq ( )

Return the squared length of this vector, a.k.a the squared norm or squared magnitude

Definition at line 292 of file Vec4f.java.

Here is the caller graph for this function:

◆ max()

Vec4f com.jogamp.math.Vec4f.max ( final Vec4f  m)

this = max(this, m), returns this.

Definition at line 153 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ min()

Vec4f com.jogamp.math.Vec4f.min ( final Vec4f  m)

this = min(this, m), returns this.

Definition at line 161 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minus() [1/2]

Vec4f com.jogamp.math.Vec4f.minus ( final Vec4f  a,
final Vec4f  b 
)

this = a - b, returns this.

Definition at line 260 of file Vec4f.java.

◆ minus() [2/2]

Vec4f com.jogamp.math.Vec4f.minus ( final Vec4f  arg)

Returns this - arg; creates new vector.

Definition at line 255 of file Vec4f.java.

Here is the call graph for this function:

◆ mul() [1/4]

Vec4f com.jogamp.math.Vec4f.mul ( final float  sx,
final float  sy,
final float  sz,
final float  sw 
)

this = this * { sx, sy, sz, sw }, returns this.

Definition at line 187 of file Vec4f.java.

◆ mul() [2/4]

Vec4f com.jogamp.math.Vec4f.mul ( final float  val)

Returns this * val; creates new vector.

Definition at line 170 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mul() [3/4]

Vec4f com.jogamp.math.Vec4f.mul ( final Vec4f  a,
final Vec4f  b 
)

this = a * b, returns this.

Definition at line 175 of file Vec4f.java.

◆ mul() [4/4]

Vec4f com.jogamp.math.Vec4f.mul ( final Vec4f  s)

this = this * s, returns this.

Definition at line 184 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalize()

Vec4f com.jogamp.math.Vec4f.normalize ( )

Normalize this vector in place.

Definition at line 299 of file Vec4f.java.

Here is the call graph for this function:

◆ plus() [1/2]

Vec4f com.jogamp.math.Vec4f.plus ( final Vec4f  a,
final Vec4f  b 
)

this = a + b, returns this.

Definition at line 228 of file Vec4f.java.

◆ plus() [2/2]

Vec4f com.jogamp.math.Vec4f.plus ( final Vec4f  arg)

Returns this + arg; creates new vector.

Definition at line 223 of file Vec4f.java.

Here is the call graph for this function:

◆ scale()

Vec4f com.jogamp.math.Vec4f.scale ( final float  s)

this = this * s, returns this.

Definition at line 214 of file Vec4f.java.

Here is the caller graph for this function:

◆ set() [1/5]

Vec4f com.jogamp.math.Vec4f.set ( final float  x,
final float  y,
final float  z,
final float  w 
)

this = { x, y, z, w }, returns this.

Definition at line 85 of file Vec4f.java.

◆ set() [2/5]

Vec4f com.jogamp.math.Vec4f.set ( final float[]  xyzw)

this = xyzw, returns this.

Definition at line 94 of file Vec4f.java.

◆ set() [3/5]

void com.jogamp.math.Vec4f.set ( final int  i,
final float  val 
)

Sets the ith component, 0 <= i < 4.

Definition at line 112 of file Vec4f.java.

◆ set() [4/5]

Vec4f com.jogamp.math.Vec4f.set ( final Vec3f  o,
final float  w 
)

this = { o, w }, returns this.

Definition at line 76 of file Vec4f.java.

◆ set() [5/5]

Vec4f com.jogamp.math.Vec4f.set ( final Vec4f  o)

this = o, returns this.

Definition at line 67 of file Vec4f.java.

Here is the caller graph for this function:

◆ setW()

void com.jogamp.math.Vec4f.setW ( final float  w)

Definition at line 150 of file Vec4f.java.

◆ setX()

void com.jogamp.math.Vec4f.setX ( final float  x)

Definition at line 147 of file Vec4f.java.

◆ setY()

void com.jogamp.math.Vec4f.setY ( final float  y)

Definition at line 148 of file Vec4f.java.

◆ setZ()

void com.jogamp.math.Vec4f.setZ ( final float  z)

Definition at line 149 of file Vec4f.java.

Here is the caller graph for this function:

◆ sub()

Vec4f com.jogamp.math.Vec4f.sub ( final Vec4f  b)

this = this - b, returns this.

Definition at line 269 of file Vec4f.java.

◆ toArray()

Vec4f com.jogamp.math.Vec4f.toArray ( final float[]  xyzw)

xyzw[0..3] = this.

{x, y, z, w}, returns this.

Definition at line 103 of file Vec4f.java.

◆ toString()

String com.jogamp.math.Vec4f.toString ( )

Definition at line 418 of file Vec4f.java.

◆ w()

float com.jogamp.math.Vec4f.w ( )

Definition at line 145 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ x()

float com.jogamp.math.Vec4f.x ( )

Definition at line 142 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ y()

float com.jogamp.math.Vec4f.y ( )

Definition at line 143 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ z()

float com.jogamp.math.Vec4f.z ( )

Definition at line 144 of file Vec4f.java.

Here is the call graph for this function:
Here is the caller graph for this function:

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