org.reprap.geometry.polygons
Class RrLine

java.lang.Object
  extended by org.reprap.geometry.polygons.RrLine

public class RrLine
extends java.lang.Object

Class to hold and manipulate parametric lines


Field Summary
private  boolean beingDestroyed
          Flag to prevent cyclic graphs going round forever
private  Rr2Point direction
          direction
private  Rr2Point origin
          origin
 
Constructor Summary
RrLine(Rr2Point a, Rr2Point b)
          Line between two points
RrLine(RrLine r)
          Copy constructor
 
Method Summary
 RrLine add(Rr2Point b)
          Move the origin
 Rr2Point cross_point(RrLine a)
          The point where another line crosses
 double cross_t(RrLine a)
          The parameter value where another line crosses
 Rr2Point d_2(Rr2Point p)
          The squared distance of a point from a line
 void destroy()
          Destroy me and all that I point to
 Rr2Point direction()
           
 double nearest(Rr2Point p)
          The nearest point on a line to another as a line parameter
 RrLine neg()
          Arithmetic
 void norm()
          Normalise the direction vector
 RrLine offset(double d)
          Offset by a distance
 Rr2Point origin()
           
 Rr2Point point(double t)
          The point at a given parameter value
 double projection(Rr2Point p)
          The parameter value of the point on the line closest to point p
 RrLine sub(Rr2Point b)
           
 java.lang.String toString()
          Make from an implicit half-plane
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

direction

private Rr2Point direction
direction


origin

private Rr2Point origin
origin


beingDestroyed

private boolean beingDestroyed
Flag to prevent cyclic graphs going round forever

Constructor Detail

RrLine

public RrLine(Rr2Point a,
              Rr2Point b)
Line between two points

Parameters:
a -
b -

RrLine

public RrLine(RrLine r)
Copy constructor

Parameters:
r -
Method Detail

destroy

public void destroy()
Destroy me and all that I point to


toString

public java.lang.String toString()
Make from an implicit half-plane

Overrides:
toString in class java.lang.Object

direction

public Rr2Point direction()
Returns:
Return the contents

origin

public Rr2Point origin()

point

public Rr2Point point(double t)
The point at a given parameter value

Parameters:
t -
Returns:
point at parameter value t

norm

public void norm()
Normalise the direction vector


neg

public RrLine neg()
Arithmetic

Returns:
inverted direction of this line

add

public RrLine add(Rr2Point b)
Move the origin

Parameters:
b -
Returns:
translated line by value b

sub

public RrLine sub(Rr2Point b)
Parameters:
b -
Returns:
??

offset

public RrLine offset(double d)
Offset by a distance

Parameters:
d -
Returns:
translated line by distance d

cross_t

public double cross_t(RrLine a)
               throws RrParallelLineException
The parameter value where another line crosses

Parameters:
a -
Returns:
parameter value
Throws:
rr_ParallelLineException
RrParallelLineException

cross_point

public Rr2Point cross_point(RrLine a)
                     throws RrParallelLineException
The point where another line crosses

Parameters:
a -
Returns:
crossing point
Throws:
rr_ParallelLineException
RrParallelLineException

nearest

public double nearest(Rr2Point p)
The nearest point on a line to another as a line parameter

Parameters:
p -
Returns:
nearest point on the eline

d_2

public Rr2Point d_2(Rr2Point p)
The squared distance of a point from a line

Parameters:
p -
Returns:
squared distance between point p and the line

projection

public double projection(Rr2Point p)
The parameter value of the point on the line closest to point p

Parameters:
p -
Returns: