Class Point

java.lang.Object
  |
  +--Point

public class Point
extends java.lang.Object

Point stores and manipulates xyz triples representing 3 space points.


Field Summary
 double X
          Holds the X component
 double Y
          Holds the Y component
 double Z
          Holds the Z component
 
Constructor Summary
Point()
          Create a new point and set it to zero
Point(double x, double y, double z)
          Create a new point with the given x,y and z values
Point(Point p)
          Create a new point by copying an existing point
 
Method Summary
static void add(Point pd, Point p, Vector v)
          Static function that write addition of a point by adding a vector to a given destiation point
static Point add(Point p, Vector v)
          Static function create a new point by adding a vector to a point.
 void add(Vector v)
          Add the given offset vector to this point
 void copy(Point p)
          Copy an existing point to this point
 boolean equals(Point p)
          Test if two points are equal
 void print(SceneWriter os)
          Print a human readable version of the point definition to the given destination
 void read(SceneReader is)
          Read the point from the given source
 void set(double x, double y, double z)
          Set this point to the given x,y and z values
 java.lang.String toString()
           
 void write(SceneWriter os)
          Write the point to the given destination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X

public double X
Holds the X component


Y

public double Y
Holds the Y component


Z

public double Z
Holds the Z component

Constructor Detail

Point

public Point()
Create a new point and set it to zero


Point

public Point(double x,
             double y,
             double z)
Create a new point with the given x,y and z values

Parameters:
x - the x value
y - the y value
z - the z value

Point

public Point(Point p)
Create a new point by copying an existing point

Method Detail

set

public void set(double x,
                double y,
                double z)
Set this point to the given x,y and z values

Parameters:
x - the x value
y - the y value
z - the z value

copy

public void copy(Point p)
Copy an existing point to this point


add

public void add(Vector v)
Add the given offset vector to this point

Parameters:
v - the vector to add

equals

public boolean equals(Point p)
Test if two points are equal


add

public static Point add(Point p,
                        Vector v)
Static function create a new point by adding a vector to a point.

Parameters:
p - the original point
v - the vector offset
Returns:
the new point

add

public static void add(Point pd,
                       Point p,
                       Vector v)
Static function that write addition of a point by adding a vector to a given destiation point

Parameters:
pd - the destination point
p - the original point
v - the vector offset

read

public void read(SceneReader is)
          throws java.io.IOException,
                 java.lang.NumberFormatException
Read the point 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
java.lang.NumberFormatException

write

public void write(SceneWriter os)
           throws java.io.IOException
Write the point to the given destination

Parameters:
os - the destination to write to
Throws:
java.io.IOException - if the write fails.

print

public void print(SceneWriter os)
           throws java.io.IOException
Print a human readable version of the point definition to the given destination

Parameters:
os - the destination to write to
Throws:
java.io.IOException - if the write fails.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object