Package org.anchoranalysis.spatial.point
Class Tuple3d
Object
Tuple3d
- All Implemented Interfaces:
Serializable
A three-dimensional tuple of double values.
- Author:
- Owen Feehan
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
absolute()
Convert each dimension's component into its absolute value.final void
add
(double x, double y, double z) Arithmetically adds values to each dimension's component.final void
add
(ReadableTuple3i toAdd) Arithmetically adds aReadableTuple3i
's values across each dimension.final void
Arithmetically adds aTuple3d
's values across each dimension.protected boolean
final void
divideBy
(double divisor) Arithmetically divide values across each dimension.final void
divideBy
(int divisor) Arithmetically divide values across each dimension.final double
dotProduct
(Tuple3d other) Computes the dot-product of the tuple with another.boolean
int
hashCode()
final void
Increments each component's value by the corresponding value in aTuple3d
.final void
incrementX
(double shift) Increments the X component's value by a shift.final void
incrementY
(double shift) Increments the Y component's value by a shift.final void
incrementZ
(double shift) Increments the Z component's value by a shift.double
length()
The magnitude of the tuple.void
Normalizes the tuple by dividing each component's value by the overall length.final void
scale
(double factor) Arithmetically multiply values across each dimension.final void
scaleXY
(double factor) Arithmetically multiply values by a factor only in X and Y dimensions.final 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.final void
setX
(int x) X-axis component of the tuple.void
setY
(double y) Y-axis component of the tuple.final void
setY
(int y) Y-axis component of the tuple.void
setZ
(double z) Z-axis component of the tuple.final void
setZ
(int z) Z-axis component of the tuple.final void
Arithmetically subtract aTuple3d
's values across each dimension.toString()
final double
valueByDimension
(int dimensionIndex) A component of the tuple corresponding to a particular dimension by index.final double
valueByDimension
(Axis axis) A component of the tuple corresponding to a particular axis.double
x()
X-axis component of the tuple.double
y()
Y-axis component of the tuple.double
z()
Z-axis component of the tuple.
-
Field Details
-
x
protected double xX-axis component of the tuple. -
y
protected double yY-axis component of the tuple. -
z
protected double zZ-axis component of the tuple.
-
-
Constructor Details
-
Tuple3d
public Tuple3d()
-
-
Method Details
-
add
public final void add(double x, double y, double z) Arithmetically adds values to each dimension's component.- Parameters:
x
- value to add to X-axis component.y
- value to add to Y-axis component.z
- value to add to Z-axis component.
-
add
Arithmetically adds aTuple3d
's values across each dimension.- Parameters:
toAdd
- tuple to add to current state.
-
add
Arithmetically adds aReadableTuple3i
's values across each dimension.- Parameters:
toAdd
- tuple to add to current state.
-
subtract
Arithmetically subtract aTuple3d
's values across each dimension.- Parameters:
toSubtract
- tuple to subtract from current state.
-
scale
public final void scale(double factor) Arithmetically multiply values across each dimension.- Parameters:
factor
- value to multiply each component's value by.
-
scaleXY
public final void scaleXY(double factor) Arithmetically multiply values by a factor only in X and Y dimensions.- Parameters:
factor
- value to multiply each component's value by.
-
divideBy
public final void divideBy(int divisor) Arithmetically divide values across each dimension.- Parameters:
divisor
- value to divide each component's value by.
-
divideBy
public final void divideBy(double divisor) Arithmetically divide values across each dimension.- Parameters:
divisor
- value to divide each component's value by.
-
absolute
public final void absolute()Convert each dimension's component into its absolute value. -
increment
Increments each component's value by the corresponding value in aTuple3d
.- Parameters:
shift
- how much to increment by.
-
incrementX
public final void incrementX(double shift) Increments the X component's value by a shift.- Parameters:
shift
- how much to increment by.
-
incrementY
public final void incrementY(double shift) Increments the Y component's value by a shift.- Parameters:
shift
- how much to increment by.
-
incrementZ
public final void incrementZ(double shift) Increments the Z component's value by a shift.- Parameters:
shift
- how much to increment by.
-
valueByDimension
A component of the tuple corresponding to a particular axis.- Parameters:
axis
- the axis.- Returns:
- the component of the tuple corresponding to that axis.
-
valueByDimension
public final double valueByDimension(int dimensionIndex) A component of the tuple corresponding to a particular dimension by index.- Parameters:
dimensionIndex
- the index corresponding to an axis, as perAxisConverter
.- Returns:
- the component of the tuple corresponding to that axis.
-
setValueByDimension
public final void setValueByDimension(int dimensionIndex, double valueToAssign) Assigns a value to a component of the tuple corresponding to a particular dimension by index.- Parameters:
dimensionIndex
- the index corresponding to an axis, as perAxisConverter
.valueToAssign
- the value to assign.
-
toString
-
setX
public final void setX(int x) X-axis component of the tuple.- Parameters:
x
- the value to set.
-
setY
public final void setY(int y) Y-axis component of the tuple.- Parameters:
y
- the value to set.
-
setZ
public final void setZ(int z) Z-axis component of the tuple.- Parameters:
z
- the value to set.
-
setX
public void setX(double x) X-axis component of the tuple.- Parameters:
x
- the value to set.
-
setY
public void setY(double y) Y-axis component of the tuple.- Parameters:
y
- the value to set.
-
setZ
public void setZ(double z) Z-axis component of the tuple.- Parameters:
z
- the value to set.
-
dotProduct
Computes the dot-product of the tuple with another.- Parameters:
other
- the other tuple to use in the dot product operation.- Returns:
- the computed dot-product.
-
length
public double length()The magnitude of the tuple.- Returns:
- the tuples's length.
-
normalize
public void normalize()Normalizes the tuple by dividing each component's value by the overall length. -
equals
-
canEqual
-
hashCode
public int hashCode() -
x
public double x()X-axis component of the tuple. -
y
public double y()Y-axis component of the tuple. -
z
public double z()Z-axis component of the tuple.
-