tracer
Class Sphere

java.lang.Object
  extended by tracer.Traceable
      extended by tracer.Sphere

public class Sphere
extends Traceable

A 3D roundish traceable thingy with a center and a radius


Field Summary
(package private)  Vec3 origin
           
(package private)  float radius
           
 
Fields inherited from class tracer.Traceable
material
 
Constructor Summary
Sphere()
           
Sphere(Vec3 o, float r)
           
 
Method Summary
 boolean hit(Ray r)
          Returns a boolean indicating whether the line segment (r.origin + t*r.direction) with 0 <= t <= 1 intersects the object.
 IntersectionInfo intersect(Ray r)
          Returns an IntersectionInfo object indicating whether the ray r intersects this object or not.
 void parse(Parser p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

origin

Vec3 origin

radius

float radius
Constructor Detail

Sphere

public Sphere(Vec3 o,
              float r)

Sphere

public Sphere()
Method Detail

parse

public void parse(Parser p)
           throws java.io.IOException
Throws:
java.io.IOException

intersect

public IntersectionInfo intersect(Ray r)
Description copied from class: Traceable
Returns an IntersectionInfo object indicating whether the ray r intersects this object or not.

Specified by:
intersect in class Traceable
See Also:
IntersectionInfo

hit

public boolean hit(Ray r)
Description copied from class: Traceable
Returns a boolean indicating whether the line segment (r.origin + t*r.direction) with 0 <= t <= 1 intersects the object.

Specified by:
hit in class Traceable