Package com.github.stephengold.joltjni
Class RVec3
java.lang.Object
com.github.stephengold.joltjni.RVec3
- All Implemented Interfaces:
RVec3Arg
A vector composed of 3 double-precision components, used to represent
locations in 3-dimensional space.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLocal(double addX, double addY, double addZ) Adds specified amounts to the vector's components and returns the (modified) current instance.getX()Return the first (X) component at positional precision.getY()Return the 2nd (Y) component at positional precision.getZ()Return the 3rd (Z) component at positional precision.booleanisFinite()Test whether all 3 components are finite.voidset(double x, double y, double z) Set all 3 components to specified values.static RVec3sZero()Create a vector with all components zero.toString()Return a string representation of the vector, which is unaffected.floatx()Return the first (X) component in single precision.doublexx()Return the first (X) component in double precision.floaty()Return the 2nd (Y) component in single precision.doubleyy()Return the 2nd (Y) component in double precision.floatz()Return the 3rd (Z) component in single precision.doublezz()Return the 3rd (Z) component in double precision.
-
Constructor Details
-
RVec3
public RVec3()Instantiate an all-zero vector (0,0,0). -
RVec3
public RVec3(double x, double y, double z) Instantiate a vector with specified components.- Parameters:
x- the desired X componenty- the desired Y componentz- the desired Z component
-
RVec3
Instantiate from a single-precision vector.- Parameters:
vec- the vector to copy (not null, unaffected)
-
-
Method Details
-
addLocal
Adds specified amounts to the vector's components and returns the (modified) current instance.- Parameters:
addX- the amount to add to the X componentaddY- the amount to add to the Y componentaddZ- the amount to add to the Z component- Returns:
- the (modified) current instance (for chaining)
-
isFinite
public boolean isFinite()Test whether all 3 components are finite.- Returns:
- true if all are finite, otherwise false
-
set
public void set(double x, double y, double z) Set all 3 components to specified values.- Parameters:
x- the desired X componenty- the desired Y componentz- the desired Z component
-
sZero
Create a vector with all components zero.- Returns:
- a new vector
-
getX
Return the first (X) component at positional precision. The vector is unaffected. -
getY
Return the 2nd (Y) component at positional precision. The vector is unaffected. -
getZ
Return the 3rd (Z) component at positional precision. The vector is unaffected. -
x
public float x()Return the first (X) component in single precision. The vector is unaffected. -
xx
public double xx()Return the first (X) component in double precision. The vector is unaffected. -
y
public float y()Return the 2nd (Y) component in single precision. The vector is unaffected. -
yy
public double yy()Return the 2nd (Y) component in double precision. The vector is unaffected. -
z
public float z()Return the 3rd (Z) component in single precision. The vector is unaffected. -
zz
public double zz()Return the 3rd (Z) component in double precision. The vector is unaffected. -
toString
Return a string representation of the vector, which is unaffected. For example, a zero vector is represented by:RVec3(0.0 0.0 0.0)
-