Class Object
java.lang.Object
|
+--Object
- Direct Known Subclasses:
- Plane, Sphere
- public abstract class Object
- extends java.lang.Object
Object superclass
Each type of object must extend and implement this class.
Method Summary |
abstract double |
intersect(Ray ray)
Find the intersection of an object and a given ray. |
abstract Vector |
normal(Point pt)
Find the normal of an object at the given point on its surface. |
abstract void |
print(SceneWriter os)
Print a human readable version of the object definition to the
given destination |
abstract void |
read(SceneReader is)
Read the object from the given source |
abstract void |
write(SceneWriter os)
Write the object to the given destination |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SurfaceMaterial
public Material SurfaceMaterial
- Holds the material of this object
Object
public Object()
intersect
public abstract double intersect(Ray ray)
- Find the intersection of an object and a given ray.
The return value is positive is the intersection is found and
this value gives the distance along the ray. Negative values
imply that the intersection was either not successful or the
intersection point was before the origin. This value can be used
with the pointAt method of the Ray class (@see Ray#pointAt)
- Parameters:
ray
- the ray to intersect with- Returns:
- a
double
value that gives the distance
along the ray.
normal
public abstract Vector normal(Point pt)
- Find the normal of an object at the given point on its surface.
- Parameters:
pt
- the surface point to find the normal at- Returns:
- a vector that contains the required normal
read
public abstract void read(SceneReader is)
throws java.io.IOException,
java.lang.NumberFormatException
- Read the object from the given source
- Parameters:
is
- the source to read from- Throws:
- java.io.IOException - if the light can not be read
- java.io.NumberFormatException - if there a number format error is encountered
write
public abstract void write(SceneWriter os)
throws java.io.IOException
- Write the object to the given destination
- Parameters:
os
- the destination to write to- Throws:
- java.io.IOException - if the write fails.
print
public abstract void print(SceneWriter os)
throws java.io.IOException
- Print a human readable version of the object definition to the
given destination
- Parameters:
os
- the destination to write to- Throws:
- java.io.IOException - if the write fails.