Class Plane
java.lang.Object
|
+--Object
|
+--Plane
- public class Plane
- extends Object
Plane represents an infinite plane object
Field Summary |
double |
Constant
Holds the constant of the plane equation |
Vector |
Normal
Holds the normal that defines this plane |
Constructor Summary |
Plane()
Create a default plane |
Plane(Material n,
Vector v,
double c)
Create a plane with the given material and plane equation
Note values are referenced not copied in the new object |
Method Summary |
double |
intersect(Ray ray)
Find the intersection of the plane and a given ray. |
Vector |
normal(Point p)
Find the normal of an object at the given point on its surface. |
void |
print(SceneWriter os)
Print a human readable version of the plane definition to the
given destination |
void |
read(SceneReader is)
Read the plane from the given source |
void |
write(SceneWriter os)
Write the plane to the given destination |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Normal
public Vector Normal
- Holds the normal that defines this plane
Constant
public double Constant
- Holds the constant of the plane equation
Plane
public Plane()
- Create a default plane
Plane
public Plane(Material n,
Vector v,
double c)
- Create a plane with the given material and plane equation
Note values are referenced not copied in the new object
- Parameters:
n
- the material for the planev
- the vector that plane is normal toc
- the constant of the plane equation
normal
public Vector normal(Point p)
- Find the normal of an object at the given point on its surface.
Note that for planes the normal is constant and a reference to
the internal vector is returned.
- Parameters:
pt
- the surface point to find the normal at- Returns:
- a reference to the fixed normal of the plane
- Overrides:
- normal in class Object
intersect
public double intersect(Ray ray)
- Find the intersection of the plane 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. - Overrides:
- intersect in class Object
read
public void read(SceneReader is)
throws java.io.IOException,
java.lang.NumberFormatException
- Read the plane 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
- Overrides:
- read in class Object
write
public void write(SceneWriter os)
throws java.io.IOException
- Write the plane to the given destination
- Parameters:
os
- the destination to write to- Throws:
- java.io.IOException - if the write fails.
- Overrides:
- write in class Object
print
public void print(SceneWriter os)
throws java.io.IOException
- Print a human readable version of the plane definition to the
given destination
- Parameters:
os
- the destination to write to- Throws:
- java.io.IOException - if the write fails.
- Overrides:
- print in class Object