Interface RVec3Arg
- All Known Implementing Classes:
RVec3
public interface RVec3Arg
Read-only access to an
RVec3
. (native type: const RVec3)-
Method Summary
Modifier and TypeMethodDescriptionReturn the cross product with the argument.double
Return the dot product with the argument.double
get
(int index) Return the specified component in double precision.getX()
Return the first (X) component in positional precision.getY()
Return the 2nd (Y) component in positional precision.getZ()
Return the 3rd (Z) component in positional precision.boolean
isFinite()
Test whether the vector contains infinities or NaNs.boolean
isNan()
Test whether the vector contains NaNs.boolean
Test whether the squared length is within 10^-12 (single-precision) or 10^-24 (double-precision) of zero.boolean
isNearZero
(double tolerance) Test whether the squared length is within the specified tolerance of zero.boolean
Test whether the vector is normalized to within a tolerance of 10^-6 (single precision) or 10^-12 (double precision).boolean
isNormalized
(double tolerance) Test whether the vector is normalized to within the specified tolerance.double
length()
Return the length.double
lengthSq()
Return the squared length.Generate a unit vector with the same direction.Generate the component-wise reciprocal.double[]
toArray()
Copy the components to an array.toVec3()
Convert to single-precision vector.float
x()
Return the first (X) component in single precision.double
xx()
Return the first (X) component in double precision.float
y()
Return the 2nd (Y) component in single precision.double
yy()
Return the 2nd (Y) component in double precision.float
z()
Return the 3rd (Z) component in single precision.double
zz()
Return the 3rd (Z) component in double precision.
-
Method Details
-
cross
Return the cross product with the argument. Both vectors are unaffected.- Parameters:
rightFactor
- the vector to cross with the current one (not null, unaffected)- Returns:
- a new product vector
-
dot
Return the dot product with the argument. Both vectors are unaffected.- Parameters:
factor
- the vector to dot with the current one (not null, unaffected)- Returns:
- the dot product
-
get
double get(int index) Return the specified component in double precision. The vector is unaffected.- Parameters:
index
- 0, 1, or 2- Returns:
- the X component if index=0, the Y component if index=1, or the Z component if index=2
- Throws:
IllegalArgumentException
- if index is not 0, 1, or 2
-
getX
Object getX()Return the first (X) component in positional precision. The vector is unaffected.- Returns:
- the component value
-
getY
Object getY()Return the 2nd (Y) component in positional precision. The vector is unaffected.- Returns:
- the component value
-
getZ
Object getZ()Return the 3rd (Z) component in positional precision. The vector is unaffected.- Returns:
- the component value
-
isFinite
boolean isFinite()Test whether the vector contains infinities or NaNs. The vector is unaffected.- Returns:
false
if one or more infinities or NaNs, otherwisetrue
-
isNan
boolean isNan()Test whether the vector contains NaNs. The vector is unaffected.- Returns:
true
if one or more NaNs, otherwisefalse
-
isNearZero
boolean isNearZero()Test whether the squared length is within 10^-12 (single-precision) or 10^-24 (double-precision) of zero. The vector is unaffected.- Returns:
true
if nearly zero, otherwisefalse
-
isNearZero
boolean isNearZero(double tolerance) Test whether the squared length is within the specified tolerance of zero. The vector is unaffected.- Parameters:
tolerance
- the desired tolerance (≥0, default=1e-12 or 1e-24)- Returns:
true
if nearly zero, otherwisefalse
-
isNormalized
boolean isNormalized()Test whether the vector is normalized to within a tolerance of 10^-6 (single precision) or 10^-12 (double precision). The vector is unaffected.- Returns:
true
if normalized, otherwisefalse
-
isNormalized
boolean isNormalized(double tolerance) Test whether the vector is normalized to within the specified tolerance. The vector is unaffected.- Parameters:
tolerance
- the desired tolerance (≥0, default=1e-6 or 1e-12)- Returns:
true
if normalized, otherwisefalse
-
length
double length()Return the length. The vector is unaffected.- Returns:
- the length
-
lengthSq
double lengthSq()Return the squared length. The vector is unaffected.- Returns:
- the squared length
-
normalized
RVec3 normalized()Generate a unit vector with the same direction. The current vector is unaffected.- Returns:
- a new vector
-
reciprocal
RVec3 reciprocal()Generate the component-wise reciprocal. The current vector is unaffected.- Returns:
- a new vector
-
toArray
double[] toArray()Copy the components to an array. The vector is unaffected.- Returns:
- a new array with length=3
-
toVec3
Vec3 toVec3()Convert to single-precision vector. The current vector is unaffected.- Returns:
- a new vector
-
x
float x()Return the first (X) component in single precision. The vector is unaffected.- Returns:
- the component value
-
xx
double xx()Return the first (X) component in double precision. The vector is unaffected.- Returns:
- the component value
-
y
float y()Return the 2nd (Y) component in single precision. The vector is unaffected.- Returns:
- the component value
-
yy
double yy()Return the 2nd (Y) component in double precision. The vector is unaffected.- Returns:
- the component value
-
z
float z()Return the 3rd (Z) component in single precision. The vector is unaffected.- Returns:
- the component value
-
zz
double zz()Return the 3rd (Z) component in double precision. The vector is unaffected.- Returns:
- the component value
-