Class Rayd

java.lang.Object
gaiasky.util.math.Rayd
All Implemented Interfaces:
java.io.Serializable

public class Rayd
extends java.lang.Object
implements java.io.Serializable
Encapsulates a Rayd having a starting position and a unit length direction.
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type Field Description
    Vector3d direction  
    Vector3d origin  
  • Constructor Summary

    Constructors
    Constructor Description
    Rayd​(Vector3d origin, Vector3d direction)
    Constructor, sets the starting position of the Rayd and the direction.
  • Method Summary

    Modifier and Type Method Description
    Rayd cpy()  
    boolean equals​(java.lang.Object o)  
    Vector3d getEndPoint​(float distance)
    Deprecated.
    Vector3d getEndPoint​(Vector3d out, float distance)
    Returns the endpoint given the distance.
    int hashCode()  
    Rayd mul​(Matrix4d matrix)
    Multiplies the Rayd by the given matrix.
    Rayd set​(float x, float y, float z, float dx, float dy, float dz)
    Sets this Rayd from the given starting position and direction.
    Rayd set​(Rayd Rayd)
    Sets the starting position and direction from the given Rayd
    Rayd set​(Vector3d origin, Vector3d direction)
    Sets the starting position and the direction of this Rayd.
    java.lang.String toString()

    Methods inherited from class java.lang.Object

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

    • origin

      public final Vector3d origin
    • direction

      public final Vector3d direction
  • Constructor Details

    • Rayd

      public Rayd​(Vector3d origin, Vector3d direction)
      Constructor, sets the starting position of the Rayd and the direction.
      Parameters:
      origin - The starting position
      direction - The direction
  • Method Details

    • cpy

      public Rayd cpy()
      Returns:
      a copy of this Rayd.
    • getEndPoint

      @Deprecated public Vector3d getEndPoint​(float distance)
      Deprecated.
      Use getEndPoint(Vector3d, float) instead. Returns the endpoint given the distance. This is calculated as startpoint + distance * direction.
      Parameters:
      distance - The distance from the end point to the start point.
      Returns:
      The end point
    • getEndPoint

      public Vector3d getEndPoint​(Vector3d out, float distance)
      Returns the endpoint given the distance. This is calculated as startpoint + distance * direction.
      Parameters:
      out - The vector to set to the result
      distance - The distance from the end point to the start point.
      Returns:
      The out param
    • mul

      public Rayd mul​(Matrix4d matrix)
      Multiplies the Rayd by the given matrix. Use this to transform a Rayd into another coordinate system.
      Parameters:
      matrix - The matrix
      Returns:
      This Rayd for chaining.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • set

      public Rayd set​(Vector3d origin, Vector3d direction)
      Sets the starting position and the direction of this Rayd.
      Parameters:
      origin - The starting position
      direction - The direction
      Returns:
      this Rayd for chaining
    • set

      public Rayd set​(float x, float y, float z, float dx, float dy, float dz)
      Sets this Rayd from the given starting position and direction.
      Parameters:
      x - The x-component of the starting position
      y - The y-component of the starting position
      z - The z-component of the starting position
      dx - The x-component of the direction
      dy - The y-component of the direction
      dz - The z-component of the direction
      Returns:
      this Rayd for chaining
    • set

      public Rayd set​(Rayd Rayd)
      Sets the starting position and direction from the given Rayd
      Parameters:
      Rayd - The Rayd
      Returns:
      This Rayd for chaining
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object