raytracer.objects
Class Surface

java.lang.Object
  |
  +--raytracer.objects.NamedObject
        |
        +--raytracer.objects.Surface
Direct Known Subclasses:
Compositum

public abstract class Surface
extends NamedObject


Field Summary
static Material DEFAULT_MATERIAL
          The material every object gets when nothing else is specified.
 
Constructor Summary
Surface()
           
 
Method Summary
abstract  Surface apply(Transformation t)
          Applies a given transformation to this object
abstract  Vector calcNormal(Point p)
          Calculates the surface normal at the given point
 Color getDiffuseColor()
           
 Color getReflection()
           
 float getRefractionIndex()
           
 Color getSpecularColor()
           
 float getSpecularExponent()
           
 Color getTransmission()
           
abstract  float intersectRay(Ray ray)
          Calculate the first intersection of a given ray with this object
 float intersectRay(Ray ray, float t)
           
abstract  boolean isInside(Point p)
          Determines whether a given point is inside this object or not
 void setMaterial(Material m)
           
 void setRotation(float x, float y, float z, float angle)
          Rotates counter-clockwise along the axis given by (0,0,0) and (x,y,z)
 void setScale(float sx, float sy, float sz)
           
 void setTranslation(float tx, float ty, float tz)
           
 
Methods inherited from class raytracer.objects.NamedObject
getName, setName, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MATERIAL

public static final Material DEFAULT_MATERIAL
The material every object gets when nothing else is specified.

Constructor Detail

Surface

public Surface()
Method Detail

intersectRay

public float intersectRay(Ray ray,
                          float t)

intersectRay

public abstract float intersectRay(Ray ray)
Calculate the first intersection of a given ray with this object

Parameters:
ray - Ray to calculate intersection with
Returns:
Distance between ray starting point and intersection point along the ray direction, INFINITY if no intersection occours

isInside

public abstract boolean isInside(Point p)
Determines whether a given point is inside this object or not

Parameters:
p - Query point
Returns:
true, if p is inside this object, otherwise false

calcNormal

public abstract Vector calcNormal(Point p)
Calculates the surface normal at the given point

Parameters:
p - Point to calculate the normal at
Returns:
Normal vector in point p

apply

public abstract Surface apply(Transformation t)
Applies a given transformation to this object

Parameters:
t - Transformation (matrix)
Returns:
Should always return "this"

getDiffuseColor

public Color getDiffuseColor()

getReflection

public Color getReflection()

getRefractionIndex

public float getRefractionIndex()

getSpecularColor

public Color getSpecularColor()

getSpecularExponent

public float getSpecularExponent()

getTransmission

public Color getTransmission()

setMaterial

public void setMaterial(Material m)

setTranslation

public void setTranslation(float tx,
                           float ty,
                           float tz)

setScale

public void setScale(float sx,
                     float sy,
                     float sz)

setRotation

public void setRotation(float x,
                        float y,
                        float z,
                        float angle)
Rotates counter-clockwise along the axis given by (0,0,0) and (x,y,z)

Parameters:
x -
y -
z -
angle -