raytracer.internal
Class Ray

java.lang.Object
  |
  +--raytracer.internal.Ray

public class Ray
extends java.lang.Object

Representation of a ray


Constructor Summary
Ray(Point p, Vector v)
          Creates a ray
 
Method Summary
 Ray advance(float t)
          Returns a new ray with the same direction but an "advanced" starting point (to avoid numeric problems)
 Point pointAt(float t)
          Returns the point which is t units away (in the ray direction) from the ray starting point
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ray

public Ray(Point p,
           Vector v)
Creates a ray

Parameters:
p - Point where the ray starts
v - Direction vector of the ray
Method Detail

pointAt

public Point pointAt(float t)
Returns the point which is t units away (in the ray direction) from the ray starting point

Parameters:
t - Number of units
Returns:
New point with the requested distance

advance

public Ray advance(float t)
Returns a new ray with the same direction but an "advanced" starting point (to avoid numeric problems)

Parameters:
t - Number of units to shift
Returns:
New ray with shifted starting point