Class Point

java.lang.Object
  extended by Point

public class Point
extends java.lang.Object

Represents a point in three dimensions, with the additional value for homogeneous coordinates.


Field Summary
static Point ORIGIN
           
 
Method Summary
 Point add(Vector v)
          Returns the point reached by starting at this point and adding a vector scaled by the given scalar.
 Point addScaled(double scalar, Vector v)
          Returns the point reached by starting at this point and adding a vector scaled by the given scalar.
static Point create(double x, double y, double z)
          Creates a point with the given coordinates, where the homogeneous value is 1.
static Point create(double x, double y, double z, double h)
          Creates a point with the given coordinates.
 double getDistanceTo(Point other)
          Returns the distance from this point to the other point, both being scaled by their homogeneous coordinates.
 double getHomogeneous()
          Returns the value added to this point for homogeneous coordinates.
 double getX()
          Returns the x-coordinate of this point.
 double getY()
          Returns the y-coordinate of this point.
 double getZ()
          Returns the z-coordinate of this point.
 Vector subtract(Point other)
          Returns the vector starting at the other point and going to this point.
 java.lang.String toString()
          Returns a conventional string representation of this point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ORIGIN

public static Point ORIGIN
Method Detail

getX

public double getX()
Returns the x-coordinate of this point.


getY

public double getY()
Returns the y-coordinate of this point.


getZ

public double getZ()
Returns the z-coordinate of this point.


getHomogeneous

public double getHomogeneous()
Returns the value added to this point for homogeneous coordinates.


toString

public java.lang.String toString()
Returns a conventional string representation of this point.

Overrides:
toString in class java.lang.Object

getDistanceTo

public double getDistanceTo(Point other)
Returns the distance from this point to the other point, both being scaled by their homogeneous coordinates.


subtract

public Vector subtract(Point other)
Returns the vector starting at the other point and going to this point. Computing this involves scaling both points by their homogeneous values.


addScaled

public Point addScaled(double scalar,
                       Vector v)
Returns the point reached by starting at this point and adding a vector scaled by the given scalar.


add

public Point add(Vector v)
Returns the point reached by starting at this point and adding a vector scaled by the given scalar.


create

public static Point create(double x,
                           double y,
                           double z)
Creates a point with the given coordinates, where the homogeneous value is 1.


create

public static Point create(double x,
                           double y,
                           double z,
                           double h)
Creates a point with the given coordinates.