raja
Class Point3D

java.lang.Object
  |
  +--raja.Point3D
All Implemented Interfaces:
Serializable, Writable
Direct Known Subclasses:
LocalGeometry

public class Point3D
extends Object
implements Serializable, Writable

The Point3D class defines a high precision point in the 3 dimensional space, given by its 3D coordinates. This class provides most of the classical operations on points (translation, distance...).

See Also:
Point2D, Vector3D, Serialized Form

Field Summary
 double x
          The x coordinate.
 double y
          The y coordinate.
 double z
          The z coordinate.
 
Constructor Summary
Point3D(double x, double y, double z)
          Creates a Point3D object initialized with the specified 3D coordinates.
Point3D(Point3D p)
          Initializes a newly created Point3D object so that it represents the same 3 dimensional point as the argument.
Point3D(Point3D p, Vector3D v)
          Initializes a newly created Point3D object so that it represents the translation of the specified Point3D by the specified Vector3D.
 
Method Summary
static Object build(ObjectReader reader)
          Creates a Point3D object from the specified ObjectReader.
static double distance(Point3D p1, Point3D p2)
          Computes the distance between the two specified Point3D.
static double distanceSq(Point3D p1, Point3D p2)
          Computes the square of the distance between the two specified Point3D.
 String toString()
          Returns a textual String representation of this Point3D object.
 void translate(Vector3D v)
          Translates this Point3D by the specified Vector3D.
 void write(ObjectWriter writer)
          Writes the contents of this Point3D object to the specified ObjectWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
The x coordinate.

y

public double y
The y coordinate.

z

public double z
The z coordinate.
Constructor Detail

Point3D

public Point3D(double x,
               double y,
               double z)
Creates a Point3D object initialized with the specified 3D coordinates.
Parameters:
x, y, z - the coordinates to which to set the newly constructed Point3D.

Point3D

public Point3D(Point3D p)
Initializes a newly created Point3D object so that it represents the same 3 dimensional point as the argument. In other words, the newly created Point3D is a copy of the specified Point3D.
Parameters:
p - a Point3D object.

Point3D

public Point3D(Point3D p,
               Vector3D v)
Initializes a newly created Point3D object so that it represents the translation of the specified Point3D by the specified Vector3D.
Parameters:
p - a Point3D object.
v - a Vector3D object.
Method Detail

build

public static Object build(ObjectReader reader)
                    throws IOException
Creates a Point3D object from the specified ObjectReader.
Parameters:
reader - the ObjectReader to read the fields from.

translate

public void translate(Vector3D v)
Translates this Point3D by the specified Vector3D.
Parameters:
v - the Vector3D to translate this Point3D by.

distance

public static double distance(Point3D p1,
                              Point3D p2)
Computes the distance between the two specified Point3D.
Parameters:
p1, p2 - the two Point3D to compute the distance between.
Returns:
the distance between the two specified Point3D.

distanceSq

public static double distanceSq(Point3D p1,
                                Point3D p2)
Computes the square of the distance between the two specified Point3D.
Parameters:
p1, p2 - the two Point3D to compute the square of the distance between.
Returns:
the square of the distance between the two specified Point3D.

toString

public String toString()
Returns a textual String representation of this Point3D object.
Overrides:
toString in class Object

write

public void write(ObjectWriter writer)
           throws IOException
Writes the contents of this Point3D object to the specified ObjectWriter.
Specified by:
write in interface Writable
Parameters:
writer - the ObjectWriter to write the fields to.