Class Ray3D

  • All Implemented Interfaces:
    Ray3DType

    public final class Ray3D
    extends java.lang.Object
    implements Ray3DType
    Immutable three-dimensional ray type, defined as an origin and a direction vector.
    Since:
    3.0.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Ray3D.Builder
      Builds instances of type Ray3D.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Ray3D.Builder builder()
      Creates a builder for Ray3D.
      static Ray3D copyOf​(Ray3DType instance)
      Creates an immutable copy of a Ray3DType value.
      com.io7m.jtensors.core.unparameterized.vectors.Vector3D direction()  
      com.io7m.jtensors.core.unparameterized.vectors.Vector3D directionInverse()  
      boolean equals​(java.lang.Object another)
      This instance is equal to all instances of Ray3D that have equal attribute values.
      int hashCode()
      Computes a hash code from attributes: origin, direction.
      static Ray3D of​(com.io7m.jtensors.core.unparameterized.vectors.Vector3D origin, com.io7m.jtensors.core.unparameterized.vectors.Vector3D direction)
      Construct a new immutable Ray3D instance.
      com.io7m.jtensors.core.unparameterized.vectors.Vector3D origin()  
      java.lang.String toString()
      Prints the immutable value Ray3D with attribute values.
      Ray3D withDirection​(com.io7m.jtensors.core.unparameterized.vectors.Vector3D value)
      Copy the current immutable object by setting a value for the direction attribute.
      Ray3D withOrigin​(com.io7m.jtensors.core.unparameterized.vectors.Vector3D value)
      Copy the current immutable object by setting a value for the origin attribute.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • origin

        public com.io7m.jtensors.core.unparameterized.vectors.Vector3D origin()
        Specified by:
        origin in interface Ray3DType
        Returns:
        The origin point of this ray
      • direction

        public com.io7m.jtensors.core.unparameterized.vectors.Vector3D direction()
        Specified by:
        direction in interface Ray3DType
        Returns:
        The direction of this ray
      • directionInverse

        public com.io7m.jtensors.core.unparameterized.vectors.Vector3D directionInverse()
        Specified by:
        directionInverse in interface Ray3DType
        Returns:
        The inverted direction of this ray
      • withOrigin

        public final Ray3D withOrigin​(com.io7m.jtensors.core.unparameterized.vectors.Vector3D value)
        Copy the current immutable object by setting a value for the origin attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for origin
        Returns:
        A modified copy of the this object
      • withDirection

        public final Ray3D withDirection​(com.io7m.jtensors.core.unparameterized.vectors.Vector3D value)
        Copy the current immutable object by setting a value for the direction attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for direction
        Returns:
        A modified copy of the this object
      • equals

        public boolean equals​(java.lang.Object another)
        This instance is equal to all instances of Ray3D that have equal attribute values.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: origin, direction.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value Ray3D with attribute values.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the value
      • of

        public static Ray3D of​(com.io7m.jtensors.core.unparameterized.vectors.Vector3D origin,
                               com.io7m.jtensors.core.unparameterized.vectors.Vector3D direction)
        Construct a new immutable Ray3D instance.
        Parameters:
        origin - The value for the origin attribute
        direction - The value for the direction attribute
        Returns:
        An immutable Ray3D instance
      • copyOf

        public static Ray3D copyOf​(Ray3DType instance)
        Creates an immutable copy of a Ray3DType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable Ray3D instance
      • builder

        public static Ray3D.Builder builder()
        Creates a builder for Ray3D.
        Returns:
        A new Ray3D builder