java.lang.Object
com.marginallyclever.convenience.Ray

public class Ray extends Object
Ray is a starting point and a direction.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ray()
     
    Ray(Ray r)
     
    Ray(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction)
     
    Ray(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction, double maxDistance)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    javax.vecmath.Vector3d
     
    double
     
    javax.vecmath.Point3d
     
    javax.vecmath.Vector3d
    getPoint(double t)
     
    void
    setDirection(javax.vecmath.Vector3d direction)
     
    void
    setMaxDistance(double maxDistance)
     
    void
    setOrigin(javax.vecmath.Point3d origin)
     
    void
    transform(javax.vecmath.Matrix4d matrix, Ray from)
    Set this ray to be a copy of another ray.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Ray

      public Ray()
    • Ray

      public Ray(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction)
    • Ray

      public Ray(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction, double maxDistance)
    • Ray

      public Ray(Ray r)
  • Method Details

    • setDirection

      public void setDirection(javax.vecmath.Vector3d direction) throws IllegalArgumentException
      Parameters:
      direction - the direction of this ray. cannot be a zero vector.
      Throws:
      IllegalArgumentException - if direction is too small
    • getDirection

      public javax.vecmath.Vector3d getDirection()
    • setOrigin

      public void setOrigin(javax.vecmath.Point3d origin)
    • getOrigin

      public javax.vecmath.Point3d getOrigin()
    • setMaxDistance

      public void setMaxDistance(double maxDistance)
    • getMaxDistance

      public double getMaxDistance()
    • getPoint

      public javax.vecmath.Vector3d getPoint(double t)
      Returns:
      start + direction * t
    • transform

      public void transform(javax.vecmath.Matrix4d matrix, Ray from)
      Set this ray to be a copy of another ray. this = matrix.transform(from)
      Parameters:
      matrix - the local transform
      from - the ray to copy