de.rico.engine.geometry.collision
Class Ray

java.lang.Object
  extended by de.rico.engine.geometry.collision.Ray

public class Ray
extends java.lang.Object

This class represents a ray. A ray can be used for triangle/line collision for example.

Author:
Frank Bruns

Constructor Summary
Ray(Point3D origin, Point3D dir)
          Creates a new ray from the specified origin with the specified direction
 
Method Summary
 Point3D getDirection()
          Returns the direction vector of this ray
 Point3D getOrigin()
          Returns the origin point of this ray.
 Point3D getPointAtDistance(float t)
          Returns the point on the ray at the specified distance t.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ray

public Ray(Point3D origin,
           Point3D dir)
Creates a new ray from the specified origin with the specified direction

Parameters:
origin -
dir - direction vector from the origin (point on the ray - origin)
Method Detail

getOrigin

public Point3D getOrigin()
Returns the origin point of this ray.

Returns:
origin point of the ray

getDirection

public Point3D getDirection()
Returns the direction vector of this ray

Returns:
direction vector of this ray

getPointAtDistance

public Point3D getPointAtDistance(float t)
Returns the point on the ray at the specified distance t. The distange should be ranged between 0.0 and 1.0.

Parameters:
t - distance on the ray (usually between 0.0 and 1.0)
Returns:
point on the ray at the specified distance