public abstract class Tuple3d extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected double |
x
X-axis component of the tuple.
|
protected double |
y
Y-axis component of the tuple.
|
protected double |
z
Z-axis component of the tuple.
|
Constructor and Description |
---|
Tuple3d() |
Modifier and Type | Method and Description |
---|---|
void |
absolute()
Convert each dimension's component into its absolute value.
|
void |
add(double x,
double y,
double z)
Arithmetically adds values to each dimension's component.
|
void |
add(ReadableTuple3i toAdd)
Arithmetically adds a
ReadableTuple3i 's values across each dimension. |
void |
add(Tuple3d toAdd)
Arithmetically adds a
Tuple3d 's values across each dimension. |
protected boolean |
canEqual(Object other) |
void |
divideBy(double divisor)
Arithmetically divide values across each dimension.
|
void |
divideBy(int divisor)
Arithmetically divide values across each dimension.
|
double |
dotProduct(Tuple3d other)
Computes the dot-product of the tuple
with another.
|
boolean |
equals(Object o) |
int |
hashCode() |
void |
increment(Tuple3d shift)
Increments each component's value by the corresponding value in a
Tuple3d . |
void |
incrementX(double shift)
Increments the X component's value by a shift.
|
void |
incrementY(double shift)
Increments the Y component's value by a shift.
|
void |
incrementZ(double shift)
Increments the Z component's value by a shift.
|
double |
length()
The magnitude of the tuple.
|
void |
normalize()
Normalizes the tuple by dividing each component's value by the overall length.
|
void |
scale(double factor)
Arithmetically multiply values across each dimension.
|
void |
scaleXY(double factor)
Arithmetically multiply values by a factor only in X and Y dimensions.
|
void |
setValueByDimension(int dimensionIndex,
double valueToAssign)
Assigns a value to a component of the tuple corresponding to a particular dimension by index.
|
void |
setX(double x)
X-axis component of the tuple.
|
void |
setX(int x)
X-axis component of the tuple.
|
void |
setY(double y)
Y-axis component of the tuple.
|
void |
setY(int y)
Y-axis component of the tuple.
|
void |
setZ(double z)
Z-axis component of the tuple.
|
void |
setZ(int z)
Z-axis component of the tuple.
|
void |
subtract(Tuple3d toSubtract)
Arithmetically subtract a
Tuple3d 's values across each dimension. |
String |
toString() |
double |
valueByDimension(Axis axis)
A component of the tuple corresponding to a particular axis.
|
double |
valueByDimension(int dimensionIndex)
A component of the tuple corresponding to a particular dimension by index.
|
double |
x()
X-axis component of the tuple.
|
double |
y()
Y-axis component of the tuple.
|
double |
z()
Z-axis component of the tuple.
|
protected double x
protected double y
protected double z
public final void add(double x, double y, double z)
x
- value to add to X-axis component.y
- value to add to Y-axis component.z
- value to add to Z-axis component.public final void add(Tuple3d toAdd)
Tuple3d
's values across each dimension.toAdd
- tuple to add to current state.public final void add(ReadableTuple3i toAdd)
ReadableTuple3i
's values across each dimension.toAdd
- tuple to add to current state.public final void subtract(Tuple3d toSubtract)
Tuple3d
's values across each dimension.toSubtract
- tuple to subtract from current state.public final void scale(double factor)
factor
- value to multiply each component's value by.public final void scaleXY(double factor)
factor
- value to multiply each component's value by.public final void divideBy(int divisor)
divisor
- value to divide each component's value by.public final void divideBy(double divisor)
divisor
- value to divide each component's value by.public final void absolute()
public final void increment(Tuple3d shift)
Tuple3d
.shift
- how much to increment by.public final void incrementX(double shift)
shift
- how much to increment by.public final void incrementY(double shift)
shift
- how much to increment by.public final void incrementZ(double shift)
shift
- how much to increment by.public final double valueByDimension(Axis axis)
axis
- the axis.public final double valueByDimension(int dimensionIndex)
dimensionIndex
- the index corresponding to an axis, as per AxisConverter
.public final void setValueByDimension(int dimensionIndex, double valueToAssign)
dimensionIndex
- the index corresponding to an axis, as per AxisConverter
.valueToAssign
- the value to assign.public final void setX(int x)
x
- the value to set.public final void setY(int y)
y
- the value to set.public final void setZ(int z)
z
- the value to set.public void setX(double x)
x
- the value to set.public void setY(double y)
y
- the value to set.public void setZ(double z)
z
- the value to set.public final double dotProduct(Tuple3d other)
other
- the other tuple to use in the dot product operation.public double length()
public void normalize()
protected boolean canEqual(Object other)
public double x()
public double y()
public double z()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.