edu.mines.jtk.sgl
Class Point3

java.lang.Object
  extended by edu.mines.jtk.sgl.Tuple3
      extended by edu.mines.jtk.sgl.Point3

public class Point3
extends Tuple3

A point with three coordinates x, y, and z.

Version:
2005.05.20
Author:
Dave Hale, Colorado School of Mines

Field Summary
 
Fields inherited from class edu.mines.jtk.sgl.Tuple3
x, y, z
 
Constructor Summary
Point3()
          Constructs a point with coordinates zero.
Point3(double x, double y, double z)
          Constructs a point with specified coordinates.
Point3(Point3 p)
          Constructs a copy of the specified point.
Point3(Point4 p)
          Constructs a point from the specified 4-d point.
 
Method Summary
 Point3 affine(double a, Point3 q)
          Returns an affine combination of this point p and the specified point q.
 double distanceTo(Point3 q)
          Returns the distance between this point p and the specified point q.
 Vector3 minus(Point3 q)
          Returns the vector v = p-q, for this point p and the specified point q.
 Point3 minus(Vector3 v)
          Returns the point q = p-v, for this point p and the specified vector v.
 Point3 minusEquals(Vector3 v)
          Moves this point p by subtracting the specified vector v.
 Point3 plus(Vector3 v)
          Returns the point q = p+v, for this point p and the specified vector v.
 Point3 plusEquals(Vector3 v)
          Moves this point p by adding the specified vector v.
 
Methods inherited from class edu.mines.jtk.sgl.Tuple3
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point3

public Point3()
Constructs a point with coordinates zero.


Point3

public Point3(double x,
              double y,
              double z)
Constructs a point with specified coordinates.

Parameters:
x - the x coordinate.
y - the y coordinate.
z - the z coordinate.

Point3

public Point3(Point4 p)
Constructs a point from the specified 4-d point. The (x,y,z) coordinates of the constructed point are (p.x/p.w,p.y/p.w,p.z/p.w).

Parameters:
p - the 4-D point.

Point3

public Point3(Point3 p)
Constructs a copy of the specified point.

Parameters:
p - the point.
Method Detail

plus

public Point3 plus(Vector3 v)
Returns the point q = p+v, for this point p and the specified vector v.

Parameters:
v - the vector v.
Returns:
the point q = p+v.

minus

public Point3 minus(Vector3 v)
Returns the point q = p-v, for this point p and the specified vector v.

Parameters:
v - the vector v.
Returns:
the point q = p-v.

minus

public Vector3 minus(Point3 q)
Returns the vector v = p-q, for this point p and the specified point q.

Parameters:
q - the point q.
Returns:
the vector v = p-q.

plusEquals

public Point3 plusEquals(Vector3 v)
Moves this point p by adding the specified vector v.

Parameters:
v - the vector v.
Returns:
this point, p += v, moved.

minusEquals

public Point3 minusEquals(Vector3 v)
Moves this point p by subtracting the specified vector v.

Parameters:
v - the vector v.
Returns:
this point, p -= v, moved.

affine

public Point3 affine(double a,
                     Point3 q)
Returns an affine combination of this point p and the specified point q.

Parameters:
a - the weight of the point q.
q - the point q.
Returns:
the affine combination (1-a)*p + a*q.

distanceTo

public double distanceTo(Point3 q)
Returns the distance between this point p and the specified point q.

Parameters:
q - the point.
Returns:
the distance |q-p|.