jumbo.euclid
Class Line3

java.lang.Object
  |
  +--jumbo.euclid.Status
        |
        +--jumbo.euclid.Line3

public class Line3
extends Status

Line3 - 3-dimensional line class

Line3 represents a 3-dimensional line. It is one of a set of primitives which can be combined to create and manipulate complex 3-dimensional objects. Lines 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.

A line is a vector which is located in space. It is described by a unit vector (v) and a point (p) on the line. Any point on the line can be used for p, and p could change during the existence of a calculation without affecting the integrity of the line, e.g. p = {1,1,1}, v = {1,0,0} is the same line as p = {2,1,1}, v = {1,0,0}. However the absolute direction of v IS important, giving the line a direction.

Default is a default Point3 (0.0, 0.0, 0.0) and default Vector3 (0.0, 0.0, 0.0). Operations on this line may lead to Exceptions such as ZeroLengthVector.


Constructor Summary
Line3()
           
Line3(Line3 l)
          copy constructor
Line3(Point3 p1, Point3 p2)
          make a line from two Point3s
Line3(Point3 p, Vector3 v)
          formed from line components
Line3(Vector3 v, Point3 p)
          other way round!
 
Method Summary
 boolean containsPoint(Point3 p)
          is a point on a line?
 boolean equals(Line3 l2)
          are two lines identical (coincident and parallel)?
 Point3 getClosestPointTo(Point3 p2)
          point on line closest to another point
 double getDistanceFromPoint(Point3 p)
          distance of a point from a line
 Point3 getIntersectionWith(Plane3 pl)
          point of intersection of line and plane
 Point3 getPoint()
          get point from line (could be any point on line)
 Vector3 getVector()
          get vector from line
 boolean isAntiparallelTo(Line3 l2)
          are two lines antiparallel
 boolean isParallelTo(Line3 l2)
          are two lines parallel (not antiparallel)
static void main(java.lang.String[] args)
          tests Line3 routines
 Line3 subtract()
          form coincident antiparallel line
 java.lang.String toString()
           
 Line3 transform(Transform3 t)
          transform a line
 
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
 

Constructor Detail

Line3

public Line3()

Line3

public Line3(Point3 p,
             Vector3 v)
formed from line components

Line3

public Line3(Vector3 v,
             Point3 p)
other way round!

Line3

public Line3(Point3 p1,
             Point3 p2)
make a line from two Point3s

Line3

public Line3(Line3 l)
copy constructor
Method Detail

equals

public boolean equals(Line3 l2)
are two lines identical (coincident and parallel)?

subtract

public Line3 subtract()
form coincident antiparallel line

getVector

public Vector3 getVector()
get vector from line

getPoint

public Point3 getPoint()
get point from line (could be any point on line)

transform

public Line3 transform(Transform3 t)
transform a line

isParallelTo

public boolean isParallelTo(Line3 l2)
are two lines parallel (not antiparallel)

isAntiparallelTo

public boolean isAntiparallelTo(Line3 l2)
are two lines antiparallel

containsPoint

public boolean containsPoint(Point3 p)
is a point on a line?

getClosestPointTo

public Point3 getClosestPointTo(Point3 p2)
point on line closest to another point

getDistanceFromPoint

public double getDistanceFromPoint(Point3 p)
distance of a point from a line

getIntersectionWith

public Point3 getIntersectionWith(Plane3 pl)
point of intersection of line and plane

toString

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

main

public static void main(java.lang.String[] args)
tests Line3 routines