Package toxi.geom

Class Ray3D

All Implemented Interfaces:
Comparable<ReadonlyVec3D>, ReadonlyVec3D

public class Ray3D extends Vec3D
A simple 3D ray datatype
  • Constructor Details

  • Method Details

    • getDirection

      public Vec3D getDirection()
      Returns a copy of the ray's direction vector.
      Returns:
      vector
    • getDistanceToPoint

      public float getDistanceToPoint(Vec3D p)
      Calculates the distance between the given point and the infinite line coinciding with this ray.
      Parameters:
      p -
      Returns:
      distance
    • getPointAtDistance

      public Vec3D getPointAtDistance(float dist)
      Returns the point at the given distance on the ray. The distance can be any real number.
      Parameters:
      dist -
      Returns:
      vector
    • setDirection

      public Ray3D setDirection(ReadonlyVec3D d)
      Uses a normalized copy of the given vector as the ray direction.
      Parameters:
      d - new direction
      Returns:
      itself
    • setNormalizedDirection

      public Ray3D setNormalizedDirection(ReadonlyVec3D d)
    • toLine3DWithPointAtDistance

      public Line3D toLine3DWithPointAtDistance(float dist)
      Converts the ray into a 3D Line segment with its start point coinciding with the ray origin and its other end point at the given distance along the ray.
      Parameters:
      dist - end point distance
      Returns:
      line segment
    • toString

      public String toString()
      Overrides:
      toString in class Vec3D