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

3D Vector based upon three double components. More...

Collaboration diagram for com.jogamp.math.Vec3d:

Public Member Functions

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

Detailed Description

3D Vector based upon three double components.

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

Definition at line 38 of file Vec3d.java.

Constructor & Destructor Documentation

◆ Vec3d() [1/6]

com.jogamp.math.Vec3d.Vec3d ( )

Definition at line 43 of file Vec3d.java.

Here is the caller graph for this function:

◆ Vec3d() [2/6]

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

Definition at line 45 of file Vec3d.java.

◆ Vec3d() [3/6]

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

Creating new Vec3f using Vec4f, dropping w.

Definition at line 50 of file Vec3d.java.

◆ Vec3d() [4/6]

com.jogamp.math.Vec3d.Vec3d ( final Vec2f  o,
final double  z 
)

Creating new Vec3f using { Vec2f, z}.

Definition at line 55 of file Vec3d.java.

◆ Vec3d() [5/6]

com.jogamp.math.Vec3d.Vec3d ( final double[]  xyz)

Definition at line 63 of file Vec3d.java.

◆ Vec3d() [6/6]

com.jogamp.math.Vec3d.Vec3d ( final double  x,
final double  y,
final double  z 
)

Definition at line 67 of file Vec3d.java.

Member Function Documentation

◆ add() [1/2]

Vec3d com.jogamp.math.Vec3d.add ( final double  dx,
final double  dy,
final double  dz 
)

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

Definition at line 232 of file Vec3d.java.

◆ add() [2/2]

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

this = this + b, returns this.

Definition at line 240 of file Vec3d.java.

◆ angle()

double com.jogamp.math.Vec3d.angle ( final Vec3d  o)

Return the angle between two vectors in radians using Math#acos(double) on cosAngle(Vec3d).

Definition at line 359 of file Vec3d.java.

Here is the call graph for this function:

◆ copy()

Vec3d com.jogamp.math.Vec3d.copy ( )

Definition at line 59 of file Vec3d.java.

Here is the call graph for this function:

◆ cosAngle()

double com.jogamp.math.Vec3d.cosAngle ( final Vec3d  o)

Return the cosine of the angle between two vectors using dot(Vec3d).

Definition at line 352 of file Vec3d.java.

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

◆ cross() [1/2]

Vec3d com.jogamp.math.Vec3d.cross ( final Vec3d  a,
final Vec3d  b 
)

this = a cross b.

NOTE: "this" must be a different vector than both a and b.

Definition at line 342 of file Vec3d.java.

◆ cross() [2/2]

Vec3d com.jogamp.math.Vec3d.cross ( final Vec3d  arg)

Returns this cross arg; creates new vector.

Definition at line 336 of file Vec3d.java.

Here is the call graph for this function:

◆ dist()

double com.jogamp.math.Vec3d.dist ( final Vec3d  o)

Return the distance between this vector and the given one.

Definition at line 322 of file Vec3d.java.

Here is the call graph for this function:

◆ distSq()

double com.jogamp.math.Vec3d.distSq ( final Vec3d  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 312 of file Vec3d.java.

Here is the caller graph for this function:

◆ div() [1/2]

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

this = this / a, returns this.

Definition at line 203 of file Vec3d.java.

◆ div() [2/2]

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

this = a / b, returns this.

Definition at line 195 of file Vec3d.java.

◆ dot()

double com.jogamp.math.Vec3d.dot ( final Vec3d  o)

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

Returns
the dot product as double

Definition at line 331 of file Vec3d.java.

Here is the caller graph for this function:

◆ equals()

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

Definition at line 409 of file Vec3d.java.

Here is the call graph for this function:

◆ get() [1/2]

double[] com.jogamp.math.Vec3d.get ( final double[]  xyz)

xyz = this, returns xyz.

Definition at line 130 of file Vec3d.java.

◆ get() [2/2]

double com.jogamp.math.Vec3d.get ( final int  i)

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

Definition at line 138 of file Vec3d.java.

◆ isEqual() [1/2]

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

Equals check using DoubleUtil#EPSILON in DoubleUtil#isEqual(double, double).

Implementation considers following corner cases:

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

Definition at line 398 of file Vec3d.java.

Here is the call graph for this function:

◆ isEqual() [2/2]

boolean com.jogamp.math.Vec3d.isEqual ( final Vec3d  o,
final double  epsilon 
)

Equals check using a given DoubleUtil#EPSILON value and DoubleUtil#isEqual(double, double, double).

Implementation considers following corner cases:

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

Definition at line 376 of file Vec3d.java.

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

◆ isZero()

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

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

it's absolute value < EPSILON.

Definition at line 269 of file Vec3d.java.

Here is the call graph for this function:

◆ length()

double com.jogamp.math.Vec3d.length ( )

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

Definition at line 276 of file Vec3d.java.

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

◆ lengthSq()

double com.jogamp.math.Vec3d.lengthSq ( )

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

Definition at line 283 of file Vec3d.java.

Here is the caller graph for this function:

◆ max()

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

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

Definition at line 156 of file Vec3d.java.

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

◆ min()

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

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

Definition at line 163 of file Vec3d.java.

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

◆ minus() [1/2]

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

this = a - b, returns this.

Definition at line 253 of file Vec3d.java.

◆ minus() [2/2]

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

Returns this - arg; creates new vector.

Definition at line 248 of file Vec3d.java.

Here is the call graph for this function:

◆ mul() [1/4]

Vec3d com.jogamp.math.Vec3d.mul ( final double  sx,
final double  sy,
final double  sz 
)

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

Definition at line 187 of file Vec3d.java.

◆ mul() [2/4]

Vec3d com.jogamp.math.Vec3d.mul ( final double  val)

Returns this * val; creates new vector.

Definition at line 171 of file Vec3d.java.

Here is the call graph for this function:

◆ mul() [3/4]

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

this = a * b, returns this.

Definition at line 176 of file Vec3d.java.

◆ mul() [4/4]

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

this = this * s, returns this.

Definition at line 184 of file Vec3d.java.

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

◆ normalize()

Vec3d com.jogamp.math.Vec3d.normalize ( )

Normalize this vector in place.

Definition at line 290 of file Vec3d.java.

Here is the call graph for this function:

◆ plus() [1/2]

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

this = a + b, returns this.

Definition at line 224 of file Vec3d.java.

◆ plus() [2/2]

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

Returns this + arg; creates new vector.

Definition at line 219 of file Vec3d.java.

Here is the call graph for this function:

◆ scale()

Vec3d com.jogamp.math.Vec3d.scale ( final double  s)

this = this * s, returns this.

Definition at line 211 of file Vec3d.java.

◆ set() [1/6]

Vec3d com.jogamp.math.Vec3d.set ( final double  x,
final double  y,
final double  z 
)

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

Definition at line 96 of file Vec3d.java.

◆ set() [2/6]

Vec3d com.jogamp.math.Vec3d.set ( final double[]  xyz)

this = xyz, returns this.

Definition at line 104 of file Vec3d.java.

◆ set() [3/6]

void com.jogamp.math.Vec3d.set ( final int  i,
final double  val 
)

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

Definition at line 120 of file Vec3d.java.

◆ set() [4/6]

Vec3d com.jogamp.math.Vec3d.set ( final Vec2f  o,
final double  z 
)

this = { o, z }, returns this.

Definition at line 80 of file Vec3d.java.

◆ set() [5/6]

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

this = o, returns this.

Definition at line 72 of file Vec3d.java.

◆ set() [6/6]

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

this = o while dropping w, returns this.

Definition at line 88 of file Vec3d.java.

◆ setX()

void com.jogamp.math.Vec3d.setX ( final double  x)

Definition at line 151 of file Vec3d.java.

◆ setY()

void com.jogamp.math.Vec3d.setY ( final double  y)

Definition at line 152 of file Vec3d.java.

◆ setZ()

void com.jogamp.math.Vec3d.setZ ( final double  z)

Definition at line 153 of file Vec3d.java.

◆ sub()

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

this = this - b, returns this.

Definition at line 261 of file Vec3d.java.

◆ toArray()

Vec3d com.jogamp.math.Vec3d.toArray ( final double[]  xyz)

xyz[0..2] = this.

{x, y, z}, returns this.

Definition at line 112 of file Vec3d.java.

◆ toString()

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

Definition at line 418 of file Vec3d.java.

◆ x()

double com.jogamp.math.Vec3d.x ( )

Definition at line 147 of file Vec3d.java.

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

◆ y()

double com.jogamp.math.Vec3d.y ( )

Definition at line 148 of file Vec3d.java.

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

◆ z()

double com.jogamp.math.Vec3d.z ( )

Definition at line 149 of file Vec3d.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: