Class Tuple3d

Object
org.anchoranalysis.spatial.point.Tuple3d
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Point3d, Vector3d

public abstract class Tuple3d
extends Object
implements Serializable
A three-dimensional tuple of double values.
Author:
Owen Feehan
See Also:
Serialized Form
  • Field Summary

    Fields 
    Modifier and Type Field 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 Summary

    Constructors 
    Constructor Description
    Tuple3d()  
  • Method Summary

    Modifier and Type Method 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​(int dimensionIndex)
    A component of the tuple corresponding to a particular dimension by index.
    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.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      protected double x
      X-axis component of the tuple.
    • y

      protected double y
      Y-axis component of the tuple.
    • z

      protected double z
      Z-axis component of the tuple.
  • Constructor Details

  • 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

      public final void add​(Tuple3d toAdd)
      Arithmetically adds a Tuple3d's values across each dimension.
      Parameters:
      toAdd - tuple to add to current state.
    • add

      public final void add​(ReadableTuple3i toAdd)
      Arithmetically adds a ReadableTuple3i's values across each dimension.
      Parameters:
      toAdd - tuple to add to current state.
    • subtract

      public final void subtract​(Tuple3d toSubtract)
      Arithmetically subtract a Tuple3d'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

      public final void increment​(Tuple3d shift)
      Increments each component's value by the corresponding value in a Tuple3d.
      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

      public final double valueByDimension​(Axis axis)
      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 per AxisConverter.
      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 per AxisConverter.
      valueToAssign - the value to assign.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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

      public final double dotProduct​(Tuple3d other)
      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

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual​(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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.