|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.reprap.geometry.polygons.RrCSG
public class RrCSG
RepRap Constructive Solid Geometry class RrCSG: 2D polygons as boolean combinations of half-planes First version 14 November 2005
Field Summary | |
---|---|
private boolean |
beingDestroyed
Flag to prevent cyclic graphs going round forever |
private RrCSG |
c1
Non-leaf child operands |
private RrCSG |
c2
|
private RrCSG |
comp
The complement (if there is one) |
private int |
complexity
How much is in here (leaf count)? |
private RrHalfPlane |
hp
Leaf half plane |
private static RrCSG |
n
Null set |
private RrCSGOp |
op
Type of set |
private static RrCSG |
u
Universal set |
Constructor Summary | |
---|---|
private |
RrCSG(boolean b)
One off constructor for the universal and null sets |
|
RrCSG(RrCSG c)
Deep copy |
private |
RrCSG(RrCSG a,
RrCSG b)
Private constructor for common work setting up booleans |
|
RrCSG(RrHalfPlane h)
Make a leaf from a single half-plane |
Method Summary | |
---|---|
RrCSG |
c_1()
Get children, operator etc |
RrCSG |
c_2()
|
private RrCSG |
categorise(RrCSG leafA)
This takes a complicated expression assumed to contain multiple instances of leafA and returns the equivalent CSG expression involving just leafA. |
RrCSG |
complement()
Lazy evaluation for complement. |
int |
complexity()
|
private RrCSG |
crossCategorise(RrCSG leafA,
RrCSG leafB)
This takes a complicated expression assumed to contain multiple instances of leafA and leafB and returns the equivalent CSG expression involving at most leafA and leafB once (except for non-manifold shapes). |
void |
destroy()
Destroy me and all that I point to |
static RrCSG |
difference(RrCSG a,
RrCSG b)
Set difference is intersection with complement |
RrCSG |
forceRegularise()
Force an approximation to the regulariseing of a set This assumes simplify has been run over the set |
static RrCSG |
intersection(RrCSG a,
RrCSG b)
Boolean operation to perform an intersection |
RrCSG |
leaf(Rr2Point p)
leaf find the half-plane that generates the value for a point |
static RrCSG |
nothing()
|
RrCSG |
offset(double d)
Offset by a distance (+ve or -ve) TODO: this should keep track of complements |
RrCSGOp |
operator()
|
RrHalfPlane |
plane()
|
RrCSG |
prune(RrRectangle b)
Prune the set to a box |
RrCSG |
regularise()
Regularise a set with simple contents ( <= 4 ) This assumes simplify has been run over the set |
private void |
replaceAllSameLeaves(RrCSG leaf,
double tolerance)
Replace duplicate of leaf with leaf itself TODO: this should also use known complements |
static RrCSG |
RrCSGFromBox(RrRectangle b)
Make a rectangle |
private void |
simplify_r(RrCSG root,
double tolerance)
Replace duplicate of all leaves with the last instance of each; also link up complements. |
RrCSG |
simplify(double tolerance)
Replace duplicate of all leaves with the last instance of each |
private java.lang.String |
toString_r(java.lang.String result,
java.lang.String white)
Convert to a string |
java.lang.String |
toString()
|
static RrCSG |
union(RrCSG a,
RrCSG b)
Boolean operations, with de Morgan simplifications |
private void |
uniqueList_r(java.util.ArrayList<RrCSG> list)
Run through a GSG expression looking at its leaves and return a list of the distinct leaves. |
private java.util.ArrayList<RrCSG> |
uniqueList()
Run through a GSG expression looking at its leaves and return a list of the distinct leaves. |
static RrCSG |
universe()
Universal or null set |
double |
value(Rr2Point p)
"Potential" value of a point; i.e. |
RrInterval |
value(RrRectangle b)
The interval value of a box (analagous to point) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final RrCSG u
private static final RrCSG n
private RrHalfPlane hp
private RrCSGOp op
private RrCSG c1
private RrCSG c2
private RrCSG comp
private int complexity
private boolean beingDestroyed
Constructor Detail |
---|
public RrCSG(RrHalfPlane h)
h
- private RrCSG(boolean b)
b
- public RrCSG(RrCSG c)
c
- private RrCSG(RrCSG a, RrCSG b)
a
- b
- Method Detail |
---|
public void destroy()
public static RrCSG universe()
public static RrCSG nothing()
public RrCSG c_1()
public RrCSG c_2()
public RrCSGOp operator()
public RrHalfPlane plane()
public int complexity()
private java.lang.String toString_r(java.lang.String result, java.lang.String white)
result
- white
-
public java.lang.String toString()
toString
in class java.lang.Object
public static RrCSG union(RrCSG a, RrCSG b)
a
- b
-
public static RrCSG intersection(RrCSG a, RrCSG b)
a
- b
-
public RrCSG complement()
public static RrCSG difference(RrCSG a, RrCSG b)
a
- b
-
public static RrCSG RrCSGFromBox(RrRectangle b)
private RrCSG categorise(RrCSG leafA)
leafA
-
private RrCSG crossCategorise(RrCSG leafA, RrCSG leafB)
leafA
- leafB
-
private void uniqueList_r(java.util.ArrayList<RrCSG> list)
expression
- private java.util.ArrayList<RrCSG> uniqueList()
expression
-
public RrCSG regularise()
public RrCSG forceRegularise()
private void replaceAllSameLeaves(RrCSG leaf, double tolerance)
leaf
- tolerance
- private void simplify_r(RrCSG root, double tolerance)
root
- tolerance
- public RrCSG simplify(double tolerance)
tolerance
-
public RrCSG offset(double d)
d
-
public RrCSG leaf(Rr2Point p)
p
-
public double value(Rr2Point p)
p
-
public RrInterval value(RrRectangle b)
b
-
public RrCSG prune(RrRectangle b)
b
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |