Clearable, Transformable, Tuple4DReadOnlyQuaternionBasics, Vector4DBasicsQuaternion, Quaternion32, Vector4D, Vector4D32public interface Tuple4DBasics extends Tuple4DReadOnly, Clearable, Transformable
A tuple 4D represents what is commonly called a quaternion. Although from definition, a
quaternion does not necessarily represent an 3D orientation, in this library the classes
implementing QuaternionReadOnly and QuaternionBasics represent unit-quaternions
meant to represent 3D orientations. The classes implementing Vector4DReadOnly and
Vector4DBasics are used to represent generic quaternions.
The write interface for a 4D tuple is more restricted than for the 2D and 3D tuples to improve data safety for the classes representing unit-quaternions.
When describing a 4D tuple, its 4 components are often gathered in two groups: the scalar part
s and the vector part (x, y, z).
Note on the difference between applying a 3D transform on a quaternion and a 4D vector:
s
remains unchanged. The vector part (x, y, z) is scaled and rotated, and
translated by s times the translation part of the transform. Note that for s = 0,
a 4D vector behaves as a 3D vector, and for s = 1 it behaves as a 3D point.
| Modifier and Type | Method | Description |
|---|---|---|
default void |
absolute() |
Sets each component of this tuple to its absolute value.
|
default boolean |
containsNaN() |
Tests if this tuple contains a
Double.NaN. |
default void |
negate() |
Changes the sign of each component of this tuple.
|
void |
normalize() |
Normalizes this tuple such that its norm is equal to 1 after calling this method and its
direction remains unchanged.
|
default void |
set(double[] tupleArray) |
Sets this tuple's components
x, y, z, s in order from the
given array tupleArray. |
void |
set(double x,
double y,
double z,
double s) |
Sets this tuple's components to
x, y, z, and s. |
default void |
set(float[] tupleArray) |
Sets this tuple's components
x, y, z, s in order from the
given array tupleArray. |
default void |
set(int startIndex,
double[] tupleArray) |
Sets this tuple's components
x, y, z, s in order from the
given array tupleArray. |
default void |
set(int startIndex,
float[] tupleArray) |
Sets this tuple's components
x, y, z, s in order from the
given array tupleArray. |
default void |
set(int startRow,
int column,
org.ejml.data.DenseMatrix64F matrix) |
Sets this tuple's components
x, y, z, s in order from the
given matrix starting to read from startRow at the column index column. |
default void |
set(int startRow,
org.ejml.data.DenseMatrix64F matrix) |
Sets this tuple's components
x, y, z, s in order from the
given column vector starting to read from startRow. |
default void |
set(org.ejml.data.DenseMatrix64F matrix) |
Sets this tuple's components
x, y, z, s in order from the
given column vector starting to read from its first row index. |
default void |
set(Tuple4DReadOnly other) |
Sets this tuple to
tupleReadOnly. |
default void |
setAndAbsolute(Tuple4DReadOnly other) |
Sets this tuple to
other and then calls absolute(). |
default void |
setAndNegate(Tuple4DReadOnly other) |
Sets this tuple to
other and then calls negate(). |
default void |
setAndNormalize(Tuple4DReadOnly other) |
Sets this tuple to
other and then calls normalize(). |
default void |
setToNaN() |
Invalidate this object by setting its values to
Double.NaN. |
applyInverseTransform, applyTransformdot, epsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32, getS, getS32, getX, getX32, getY, getY32, getZ, getZ32, norm, normSquaredvoid set(double x,
double y,
double z,
double s)
x, y, z, and s.x - the new value for the x-component of this tuple.y - the new value for the y-component of this tuple.z - the new value for the z-component of this tuple.s - the new value for the s-component of this tuple.void normalize()
Edge cases:
Double.NaN, this method is ineffective.
default void setToNaN()
ClearableDouble.NaN.default boolean containsNaN()
Double.NaN.containsNaN in interface ClearablecontainsNaN in interface Tuple4DReadOnlytrue if this tuple contains a Double.NaN, false otherwise.default void absolute()
default void negate()
default void set(Tuple4DReadOnly other)
tupleReadOnly.other - the other tuple to copy the values from. Not modified.default void set(double[] tupleArray)
x, y, z, s in order from the
given array tupleArray.tupleArray - the array containing the new values for this tuple's components. Not
modified.default void set(int startIndex,
double[] tupleArray)
x, y, z, s in order from the
given array tupleArray.startIndex - the first index to start reading from in the array.tupleArray - the array containing the new values for this tuple's components. Not
modified.default void set(float[] tupleArray)
x, y, z, s in order from the
given array tupleArray.tupleArray - the array containing the new values for this tuple's components. Not
modified.default void set(int startIndex,
float[] tupleArray)
x, y, z, s in order from the
given array tupleArray.startIndex - the first index to start reading from in the array.tupleArray - the array containing the new values for this tuple's components. Not
modified.default void set(org.ejml.data.DenseMatrix64F matrix)
x, y, z, s in order from the
given column vector starting to read from its first row index.matrix - the column vector containing the new values for this tuple's components. Not
modified.default void set(int startRow,
org.ejml.data.DenseMatrix64F matrix)
x, y, z, s in order from the
given column vector starting to read from startRow.startRow - the first row index to start reading in the dense-matrix.matrix - the column vector containing the new values for this tuple's components. Not
modified.default void set(int startRow,
int column,
org.ejml.data.DenseMatrix64F matrix)
x, y, z, s in order from the
given matrix starting to read from startRow at the column index column.startRow - the first row index to start reading in the dense-matrix.column - the column index to read in the dense-matrix.matrix - the column vector containing the new values for this tuple's components. Not
modified.default void setAndAbsolute(Tuple4DReadOnly other)
other and then calls absolute().other - the other tuple to copy the values from. Not modified.default void setAndNegate(Tuple4DReadOnly other)
other and then calls negate().other - the other tuple to copy the values from. Not modified.default void setAndNormalize(Tuple4DReadOnly other)
other and then calls normalize().other - the other tuple to copy the values from. Not modified.