public interface Tuple3DBasics extends Tuple3DReadOnly, Clearable, Transformable
A tuple is an abstract geometry object holding onto the common math between a 3D point and vector.
Although a point and vector hold onto the same type of information, the distinction is made between them as they represent different geometry objects and are typically not handled the same way:
| Modifier and Type | Method and Description |
|---|---|
default void |
absolute()
Sets each component of this tuple to its absolute value.
|
default void |
add(double x,
double y,
double z)
Adds the given (
x, y, z)-tuple to this tuple. |
default void |
add(Tuple3DReadOnly other)
Adds the given tuple to this tuple.
|
default void |
add(Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2)
Sets this tuple to the sum of the two given tuples.
|
default void |
addX(double x)
Adds the given
x to this tuple's x-component. |
default void |
addY(double y)
Adds the given
y to this tuple's y-component. |
default void |
addZ(double z)
Adds the given
z to this tuple's z-component. |
default void |
clipToMax(double max)
Clips each component of this tuple to a maximum value
max. |
default void |
clipToMin(double min)
Clips each component of this tuple to a minimum value
min. |
default void |
clipToMinMax(double min,
double max)
Clips each component of this tuple to a minimum value
min and a maximum value
max. |
default boolean |
containsNaN()
Tests if this tuple contains a
Double.NaN. |
default void |
interpolate(Tuple3DReadOnly other,
double alpha)
Performs a linear interpolation from this tuple to
other given the percentage
alpha. |
default void |
interpolate(Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2,
double alpha)
Performs a linear interpolation from
tuple1 to tuple2 given the percentage
alpha. |
default void |
negate()
Changes the sign of each component of this tuple.
|
default void |
scale(double scalar)
Scales the components of this tuple by the given
scalar. |
default void |
scale(double scalarX,
double scalarY,
double scalarZ)
Scales independently each component of this tuple.
|
default void |
scaleAdd(double scalar,
Tuple3DReadOnly other)
Scales this tuple and adds
other. |
default void |
scaleAdd(double scalar,
Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2)
Sets this tuple to the sum of
tuple1 scaled and tuple2. |
default void |
scaleSub(double scalar,
Tuple3DReadOnly other)
Scales this tuple and subtracts
other. |
default void |
scaleSub(double scalar,
Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2)
Sets this tuple to the difference of
tuple1 scaled and tuple2. |
default void |
set(org.ejml.data.DenseMatrix64F matrix)
Sets this tuple's components
x, y, z in order from the given column
vector starting to read from its first row index. |
default void |
set(double[] tupleArray)
Sets this tuple's components
x, y, z in order from the given array
tupleArray. |
default void |
set(double x,
double y,
double z)
Sets this tuple's components to
x, y, and z. |
default void |
set(float[] tupleArray)
Sets this tuple's components
x, y, z in order from the given array
tupleArray. |
default void |
set(int startRow,
org.ejml.data.DenseMatrix64F matrix)
Sets this tuple's components
x, y, z in order from the given column
vector starting to read from startRow. |
default void |
set(int startIndex,
double[] tupleArray)
Sets this tuple's components
x, y, z in order from the given array
tupleArray. |
default void |
set(int startIndex,
float[] tupleArray)
Sets this tuple's components
x, y, z 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 in order from the given matrix
starting to read from startRow at the column index column. |
default void |
set(Tuple2DReadOnly tuple2DReadOnly)
Sets the x and y components of this tuple with the x and y components of the given
tuple2DReadOnly. |
default void |
set(Tuple2DReadOnly tuple2DReadOnly,
double z)
Sets the x and y components of this tuple with the x and y components of the given
tuple2DReadOnly and the z-component to the given z. |
default void |
set(Tuple3DReadOnly tupleReadOnly)
Sets this tuple to
tupleReadOnly. |
default void |
setAndAbsolute(Tuple3DReadOnly other)
Sets this tuple to
other and then calls absolute(). |
default void |
setAndClipToMax(double max,
Tuple3DReadOnly other)
Sets this tuple to
other and then calls clipToMax(double). |
default void |
setAndClipToMin(double min,
Tuple3DReadOnly other)
Sets this tuple to
other and then calls clipToMin(double). |
default void |
setAndClipToMinMax(double min,
double max,
Tuple3DReadOnly other)
Sets this tuple to
other and then calls clipToMinMax(double, double). |
default void |
setAndNegate(Tuple3DReadOnly other)
Sets this tuple to
other and then calls negate(). |
default void |
setAndScale(double scalar,
Tuple3DReadOnly other)
Sets this tuple to
other and then calls scale(double). |
default void |
setElement(int index,
double value)
Selects a component of this tuple based on
index and sets it to value. |
default void |
setToNaN()
Sets all the components of this tuple to
Double.NaN. |
default void |
setToZero()
Sets all the components of this tuple to zero.
|
void |
setX(double x)
Sets the x-component of this tuple.
|
void |
setY(double y)
Sets the y-component of this tuple.
|
void |
setZ(double z)
Sets the z-component of this tuple.
|
default void |
sub(double x,
double y,
double z)
Subtracts the given (
x, y, z)-tuple to this tuple. |
default void |
sub(Tuple3DReadOnly other)
Subtracts the given tuple to this tuple.
|
default void |
sub(Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2)
Sets this tuple to the difference of the two given tuples.
|
default void |
subX(double x)
Subtracts the given
x to this tuple's x-component. |
default void |
subY(double y)
Subtracts the given
y to this tuple's y-component. |
default void |
subZ(double z)
Subtracts the given
z to this tuple's z-component. |
epsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32, getX, getX32, getY, getY32, getZ, getZ32applyInverseTransform, applyTransformvoid setX(double x)
x - the new x-component's value.void setY(double y)
y - the new y-component's value.void setZ(double z)
z - the new z-component's value.default void setToZero()
default void setToNaN()
Double.NaN.default boolean containsNaN()
Double.NaN.containsNaN in interface ClearablecontainsNaN in interface Tuple3DReadOnlytrue if this tuple contains a Double.NaN, false otherwise.default void absolute()
default void negate()
default void clipToMax(double max)
max.max - the maximum value for each component.default void clipToMin(double min)
min.min - the minimum value for each component.default void clipToMinMax(double min,
double max)
min and a maximum value
max.min - the minimum value for each component.max - the maximum value for each component.default void setElement(int index,
double value)
index and sets it to value.
For an index of 0, the corresponding component is x, 1 it is y, 2 it
is z.
index - the index of the component to set.value - the new value of the selected component.java.lang.IndexOutOfBoundsException - if index ∉ [0, 2].default void set(double x,
double y,
double z)
x, y, and z.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.default void set(Tuple2DReadOnly tuple2DReadOnly)
tuple2DReadOnly.
The z component remains unchanged.
tuple2DReadOnly - the tuple to copy the values from. Not modified.default void set(Tuple2DReadOnly tuple2DReadOnly, double z)
tuple2DReadOnly and the z-component to the given z.tuple2DReadOnly - the tuple to copy the values from. Not modified.z - the new z-coordinate for this tuple.default void set(Tuple3DReadOnly tupleReadOnly)
tupleReadOnly.tupleReadOnly - the other tuple to copy the values from. Not modified.default void set(double[] tupleArray)
x, y, z 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 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 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 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 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 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 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(Tuple3DReadOnly other)
other and then calls absolute().other - the other tuple to copy the values from. Not modified.default void setAndNegate(Tuple3DReadOnly other)
other and then calls negate().other - the other tuple to copy the values from. Not modified.default void setAndScale(double scalar,
Tuple3DReadOnly other)
other and then calls scale(double).scalar - the scale factor to use on this tuple.other - the other tuple to copy the values from. Not modified.default void setAndClipToMax(double max,
Tuple3DReadOnly other)
other and then calls clipToMax(double).max - the maximum value for each component of this tuple.other - the other tuple to copy the values from. Not modified.default void setAndClipToMin(double min,
Tuple3DReadOnly other)
other and then calls clipToMin(double).min - the minimum value for each component of this tuple.other - the other tuple to copy the values from. Not modified.default void setAndClipToMinMax(double min,
double max,
Tuple3DReadOnly other)
other and then calls clipToMinMax(double, double).min - the minimum value for each component of this tuple.max - the maximum value for each component of this tuple.other - the other tuple to copy the values from. Not modified.default void addX(double x)
x to this tuple's x-component.x - the value to add.default void addY(double y)
y to this tuple's y-component.y - the value to add.default void addZ(double z)
z to this tuple's z-component.z - the value to add.default void add(double x,
double y,
double z)
x, y, z)-tuple to this tuple.
this = this + (x, y, z)
x - the value to add to the x-component of this tuple.y - the value to add to the y-component of this tuple.z - the value to add to the z-component of this tuple.default void add(Tuple3DReadOnly other)
this = this + other
other - the other tuple to add to this tuple. Not modified.default void add(Tuple3DReadOnly tuple1, Tuple3DReadOnly tuple2)
this = tuple1 + tuple2
tuple1 - the first tuple to sum. Not modified.tuple2 - the second tuple to sum. Not modified.default void subX(double x)
x to this tuple's x-component.x - the value to add.default void subY(double y)
y to this tuple's y-component.y - the value to add.default void subZ(double z)
z to this tuple's z-component.z - the value to add.default void sub(double x,
double y,
double z)
x, y, z)-tuple to this tuple.
this = this - (x, y, z)
x - the value to add to the x-component of this tuple.y - the value to add to the y-component of this tuple.z - the value to add to the z-component of this tuple.default void sub(Tuple3DReadOnly other)
this = this - other
other - the other tuple to subtract to this tuple.default void sub(Tuple3DReadOnly tuple1, Tuple3DReadOnly tuple2)
this = tuple1 - tuple2
tuple1 - the first tuple. Not modified.tuple2 - the second tuple to subtract to tuple1. Not modified.default void scale(double scalar)
scalar.
this = scalar * this
scalar - the scale factor to use.default void scale(double scalarX,
double scalarY,
double scalarZ)
/ this.x \ / scalarX * this.x \ | this.y | = | scalarY * this.y | \ this.z / \ scalarZ * this.z /
scalarX - the scalar factor to use on the x-component of this tuple.scalarY - the scalar factor to use on the y-component of this tuple.scalarZ - the scalar factor to use on the z-component of this tuple.default void scaleAdd(double scalar,
Tuple3DReadOnly other)
other.
this = scalar * this + other
scalar - the scale factor to use.other - the tuple to add to this. Not modified.default void scaleAdd(double scalar,
Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2)
tuple1 scaled and tuple2.
this = scalar * tuple1 + tuple2
scalar - the scale factor to use on tuple1.tuple1 - the first tuple of the sum. Not modified.tuple2 - the second tuple of the sum. Not modified.default void scaleSub(double scalar,
Tuple3DReadOnly other)
other.
this = scalar * this - other
scalar - the scale factor to use.other - the tuple to subtract to this. Not modified.default void scaleSub(double scalar,
Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2)
tuple1 scaled and tuple2.
this = scalar * tuple1 - tuple2
scalar - the scale factor to use on tuple1.tuple1 - the first tuple of the difference. Not modified.tuple2 - the second tuple of the difference. Not modified.default void interpolate(Tuple3DReadOnly other, double alpha)
other given the percentage
alpha.
this = (1.0 - alpha) * this + alpha * other
other - the other tuple used for the interpolation. Not modified.alpha - the percentage used for the interpolation. A value of 0 will result in not
modifying this tuple, while a value of 1 is equivalent to setting this tuple to
other.default void interpolate(Tuple3DReadOnly tuple1, Tuple3DReadOnly tuple2, double alpha)
tuple1 to tuple2 given the percentage
alpha.
this = (1.0 - alpha) * tuple1 + alpha * tuple2
tuple1 - the first tuple used in the interpolation. Not modified.tuple2 - the second tuple used in the interpolation. Not modified.alpha - the percentage to use for the interpolation. A value of 0 will result in setting
this tuple to tuple1, while a value of 1 is equivalent to setting this tuple
to tuple2.