Package org.anchoranalysis.spatial.point
Class Tuple3d
Object
org.anchoranalysis.spatial.point.Tuple3d
- All Implemented Interfaces:
Serializable
public abstract class Tuple3d extends Object implements Serializable
A three-dimensional tuple of double values.
- Author:
- Owen Feehan
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Tuple3d() -
Method Summary
Modifier and Type Method Description voidabsolute()Convert each dimension's component into its absolute value.voidadd(double x, double y, double z)Arithmetically adds values to each dimension's component.voidadd(ReadableTuple3i toAdd)Arithmetically adds aReadableTuple3i's values across each dimension.voidadd(Tuple3d toAdd)Arithmetically adds aTuple3d's values across each dimension.protected booleancanEqual(Object other)voiddivideBy(double divisor)Arithmetically divide values across each dimension.voiddivideBy(int divisor)Arithmetically divide values across each dimension.doubledotProduct(Tuple3d other)Computes the dot-product of the tuple with another.booleanequals(Object o)inthashCode()voidincrement(Tuple3d shift)Increments each component's value by the corresponding value in aTuple3d.voidincrementX(double shift)Increments the X component's value by a shift.voidincrementY(double shift)Increments the Y component's value by a shift.voidincrementZ(double shift)Increments the Z component's value by a shift.doublelength()The magnitude of the tuple.voidnormalize()Normalizes the tuple by dividing each component's value by the overall length.voidscale(double factor)Arithmetically multiply values across each dimension.voidscaleXY(double factor)Arithmetically multiply values by a factor only in X and Y dimensions.voidsetValueByDimension(int dimensionIndex, double valueToAssign)Assigns a value to a component of the tuple corresponding to a particular dimension by index.voidsetX(double x)X-axis component of the tuple.voidsetX(int x)X-axis component of the tuple.voidsetY(double y)Y-axis component of the tuple.voidsetY(int y)Y-axis component of the tuple.voidsetZ(double z)Z-axis component of the tuple.voidsetZ(int z)Z-axis component of the tuple.voidsubtract(Tuple3d toSubtract)Arithmetically subtract aTuple3d's values across each dimension.StringtoString()doublevalueByDimension(int dimensionIndex)A component of the tuple corresponding to a particular dimension by index.doublevalueByDimension(Axis axis)A component of the tuple corresponding to a particular axis.doublex()X-axis component of the tuple.doubley()Y-axis component of the tuple.doublez()Z-axis component of the tuple.
-
Field Details
-
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.
-