jumbo.euclid
Class Point3

java.lang.Object
  |
  +--jumbo.euclid.Status
        |
        +--jumbo.euclid.Point3
Direct Known Subclasses:
Coordinate3

public class Point3
extends Status

Point3 - 3-dimensional point class

Point3 represents a 3-dimensional point. It is one of a set of primitives which can be combined to create and manipulate complex 3-dimensional objects. Points can be transformed with rotation matrices or rotation-translation matrices (Transform3), can be calculated from other primitives or can be used to generate other primitives.

Default point is 0.0, 0.0, 0.0

See Also:
Vector3, Line3, Point3Vector, Plane3

Field Summary
protected  double[] flarray
          the coordinates of the point
 
Constructor Summary
Point3()
           
Point3(double[] f)
          constructor from a double[] (or a RealArray)
Point3(double x, double y, double z)
          formed from point components
Point3(Point3 p)
          copy constructor
Point3(Vector3 v)
          make a point from a vector
 
Method Summary
 Point3 clone(double[] f)
          overloaded assignment from a double[] (or a RealArray)
 Point3 clone(Point3 p)
           
 Point3 clone(Vector3 v)
          from Vector3
 double distanceFromLine(Line3 l)
           
 double distanceFromPlane(Plane3 pl)
           
 Point3 divideBy(double f)
           
 double elementAt(int n)
          subscript operator counts from ZERO
 boolean equals(Point3 p)
          are two points identical?
static Angle getAngle(Point3 p1, Point3 p2, Point3 p3)
          angle (p1-p2-p3; vertex is p2)
 double[] getArray()
          get components as double[]
 Point3 getClosestPointOnLine(Line3 l)
           
 double getDistanceFromOrigin()
          distance of point from origin
 double getDistanceFromPoint(Point3 p2)
          distance of point from another point
 Point3 getMidPoint(Point3 p2)
          mid-point of two points
static Angle getTorsion(Point3 p1, Point3 p2, Point3 p3, Point3 p4)
          torsion angle
 boolean isOrigin()
          is a point at Origin?
static void main(java.lang.String[] args)
          tests Point3 routines = new Point3
 Point3 multiplyBy(double f)
          scale point
 Point3 plus(Point3 p)
          New point from point+point - used for finding centrois, etc.
 Point3 plus(Vector3 v)
          New point from point+vector
 Vector3 subtract(Point3 p2)
          vector between two points
 Point3 subtract(Vector3 v)
          New point from point-vector
 java.lang.String toString()
           
 Point3 transform(Transform3 t)
          transform a point; does NOT modify 'this'
 
Methods inherited from class jumbo.euclid.Status
NYI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

flarray

protected double[] flarray
the coordinates of the point
Constructor Detail

Point3

public Point3()

Point3

public Point3(double x,
              double y,
              double z)
formed from point components

Point3

public Point3(Point3 p)
copy constructor

Point3

public Point3(double[] f)
constructor from a double[] (or a RealArray)

Point3

public Point3(Vector3 v)
make a point from a vector
Method Detail

clone

public Point3 clone(Point3 p)

clone

public Point3 clone(double[] f)
overloaded assignment from a double[] (or a RealArray)

getArray

public double[] getArray()
get components as double[]

clone

public Point3 clone(Vector3 v)
from Vector3

equals

public boolean equals(Point3 p)
are two points identical?

subtract

public Vector3 subtract(Point3 p2)
vector between two points

plus

public Point3 plus(Point3 p)
New point from point+point - used for finding centrois, etc.

plus

public Point3 plus(Vector3 v)
New point from point+vector

subtract

public Point3 subtract(Vector3 v)
New point from point-vector

multiplyBy

public Point3 multiplyBy(double f)
scale point

divideBy

public Point3 divideBy(double f)

elementAt

public double elementAt(int n)
subscript operator counts from ZERO

transform

public Point3 transform(Transform3 t)
transform a point; does NOT modify 'this'

getDistanceFromOrigin

public double getDistanceFromOrigin()
distance of point from origin

getDistanceFromPoint

public double getDistanceFromPoint(Point3 p2)
distance of point from another point

distanceFromPlane

public double distanceFromPlane(Plane3 pl)

getClosestPointOnLine

public Point3 getClosestPointOnLine(Line3 l)
Parameters:
l - any line
Returns:
the point p on line l where this-p distance is shortest

distanceFromLine

public double distanceFromLine(Line3 l)

getMidPoint

public Point3 getMidPoint(Point3 p2)
mid-point of two points

getAngle

public static Angle getAngle(Point3 p1,
                             Point3 p2,
                             Point3 p3)
                      throws ZeroVectorException
angle (p1-p2-p3; vertex is p2)
Throws:
ZeroVectorException - two points are coincident

getTorsion

public static Angle getTorsion(Point3 p1,
                               Point3 p2,
                               Point3 p3,
                               Point3 p4)
                        throws ZeroVectorException
torsion angle
Throws:
ZeroVectorException - two points are coincident or three points are colinear

isOrigin

public boolean isOrigin()
is a point at Origin?

toString

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

main

public static void main(java.lang.String[] args)
tests Point3 routines = new Point3