org.reprap.geometry.polygons
Class RrHalfPlane

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

public class RrHalfPlane
extends java.lang.Object

Class to hold and manipulate linear half-planes


Field Summary
private  boolean beingDestroyed
          Flag to prevent cyclic graphs going round forever
private  Rr2Point normal
          The half-plane is normal*(x, y) + offset <= 0
private  double offset
           
private  RrLine p
          Keep the parametric equivalent to save computing it
 
Constructor Summary
RrHalfPlane(Rr2Point a, Rr2Point b)
          Make one from two points on its edge
RrHalfPlane(RrHalfPlane a)
          Deep copy
RrHalfPlane(RrLine l)
          Convert a parametric line
 
Method Summary
 RrHalfPlane complement()
          Change the sense
 Rr2Point cross_point(RrHalfPlane a)
          The point where another line crosses
 Rr2Point cross_point(RrLine a)
          Point where a parametric line crosses
 double cross_t(RrLine a)
          Parameter value where a line crosses
 void destroy()
          Destroy me and all that I point to
 Rr2Point normal()
          Get the components
 double offset()
           
 RrHalfPlane offset(double d)
          Move
 RrLine pLine()
          Get the parametric equivalent
static int same(RrHalfPlane a, RrHalfPlane b, double tolerance)
          Is another line the same within a tolerance?
 java.lang.String toString()
          Return the plane as a string
 double value(Rr2Point p)
          Find the potential value of a point
 RrInterval value(RrRectangle b)
          Find the potential interval of a box
 RrInterval wipe(RrLine a, RrInterval range)
          Take a range of parameter values and a line, and find the intersection of that range with the part of the line (if any) on the solid side of the half-plane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

normal

private Rr2Point normal
The half-plane is normal*(x, y) + offset <= 0


offset

private double offset

p

private RrLine p
Keep the parametric equivalent to save computing it


beingDestroyed

private boolean beingDestroyed
Flag to prevent cyclic graphs going round forever

Constructor Detail

RrHalfPlane

public RrHalfPlane(RrLine l)
Convert a parametric line

Parameters:
l -

RrHalfPlane

public RrHalfPlane(Rr2Point a,
                   Rr2Point b)
Make one from two points on its edge

Parameters:
a -
b -

RrHalfPlane

public RrHalfPlane(RrHalfPlane a)
Deep copy

Parameters:
a -
Method Detail

destroy

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


pLine

public RrLine pLine()
Get the parametric equivalent

Returns:
parametric equivalent of a line

toString

public java.lang.String toString()
Return the plane as a string

Overrides:
toString in class java.lang.Object
Returns:
string representation

normal

public Rr2Point normal()
Get the components

Returns:
components?

offset

public double offset()

same

public static int same(RrHalfPlane a,
                       RrHalfPlane b,
                       double tolerance)
Is another line the same within a tolerance?

Parameters:
a -
b -
tolerance -
Returns:
0 if the distance between halfplane a and b is less then the tolerance, -1 if one is the complement of the other within the tolerance, otherwise 1

complement

public RrHalfPlane complement()
Change the sense

Returns:
complent of half plane

offset

public RrHalfPlane offset(double d)
Move

Parameters:
d -
Returns:
offset halfplane

value

public double value(Rr2Point p)
Find the potential value of a point

Parameters:
p -
Returns:
potential value of point p

value

public RrInterval value(RrRectangle b)
Find the potential interval of a box

Parameters:
b -
Returns:
potential interval of box b

cross_point

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

Parameters:
a -
Returns:
cross point
Throws:
RrParallelLineException

cross_t

public double cross_t(RrLine a)
               throws RrParallelLineException
Parameter value where a line crosses

Parameters:
a -
Returns:
parameter value
Throws:
RrParallelLineException

cross_point

public Rr2Point cross_point(RrLine a)
                     throws RrParallelLineException
Point where a parametric line crosses

Parameters:
a -
Returns:
cross point
Throws:
RrParallelLineException

wipe

public RrInterval wipe(RrLine a,
                       RrInterval range)
Take a range of parameter values and a line, and find the intersection of that range with the part of the line (if any) on the solid side of the half-plane.

Parameters:
a -
range -
Returns:
intersection interval