Interface RVec3Arg
- All Known Implementing Classes:
RVec3
public interface RVec3Arg
Read-only access to an
RVec3. (native type: const RVec3)-
Method Summary
Modifier and TypeMethodDescriptionvoidcopyTo(DoubleBuffer storeDoubles) Write all 3 components to the start of the specified buffer.Return the cross product with the argument.doubleReturn the dot product with the argument.doubleget(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.booleanisFinite()Test whether the vector contains infinities or NaNs.booleanisNan()Test whether the vector contains NaNs.booleanTest whether the squared length is within 10^-12 (single-precision) or 10^-24 (double-precision) of zero.booleanisNearZero(double tolerance) Test whether the squared length is within the specified tolerance of zero.booleanTest whether the vector is normalized to within a tolerance of 10^-6 (single precision) or 10^-12 (double precision).booleanisNormalized(double tolerance) Test whether the vector is normalized to within the specified tolerance.doublelength()Return the length.doublelengthSq()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.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.
-
Method Details
-
copyTo
Write all 3 components to the start of the specified buffer. The vector is unaffected.- Parameters:
storeDoubles- the destination buffer (not null, capacity≥3)
-
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:
falseif one or more infinities or NaNs, otherwisetrue
-
isNan
boolean isNan()Test whether the vector contains NaNs. The vector is unaffected.- Returns:
trueif 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:
trueif 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:
trueif 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:
trueif 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:
trueif 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
-