public class CSG extends java.lang.Object implements IuserAPI, java.io.Serializable
This implementation is a Java port of
https://github.com/evanw/csg.js/ with
some additional features like polygon extrude, transformations etc. Thanks to
the author for creating the CSG.js library.
Implementation Details
All CSG operations are implemented in terms of two functions,
Node.clipTo(eu.mihosoft.vrl.v3d.Node) and Node.invert(),
which remove parts of a BSP tree inside another BSP tree and swap solid and
empty space, respectively. To find the union of a and b, we
want to remove everything in a inside b and everything in
b inside a, then combine polygons from a and
b into one solid:
a.clipTo(b); b.clipTo(a); a.build(b.allPolygons());
The only tricky part is handling overlapping coplanar polygons in both trees.
The code above keeps both copies, but we need to keep them in one tree and
remove them in the other tree. To remove them from b we can clip the
inverse of b against a. The code for union now looks like
this:
a.clipTo(b); b.clipTo(a); b.invert(); b.clipTo(a); b.invert(); a.build(b.allPolygons());
Subtraction and intersection naturally follow from set operations. If union
is A | B, differenceion is A - B = ~(~A | B) and intersection
is A & B =
~(~A | ~B) where ~ is the complement operator.
| Modifier and Type | Class and Description |
|---|---|
static class |
CSG.OptType
The Enum OptType.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
INDEX_OF_PARAMETRIC_DEFAULT |
static int |
INDEX_OF_PARAMETRIC_LOWER |
static int |
INDEX_OF_PARAMETRIC_UPPER |
| Constructor and Description |
|---|
CSG()
Instantiates a new csg.
|
| Modifier and Type | Method and Description |
|---|---|
CSG |
addAssemblyStep(int stepNumber,
Transform explodedPose) |
CSG |
addCreationEventStackTraceList(java.util.ArrayList<java.lang.Exception> incoming) |
CSG |
addCreationEventString(java.lang.String thisline) |
CSG |
addCreationEventStringList(java.util.ArrayList<java.lang.String> incoming) |
CSG |
addDatumReference(Transform t) |
CSG |
addExportFormat(java.lang.String exportFormat) |
CSG |
addGroupMembership(java.lang.String groupID) |
CSG |
addIsGroupResult(java.lang.String res) |
CSG |
addSlicePlane(Transform slicePlane) |
java.util.ArrayList<CSG> |
addTabs(Vector3d edgeDirection,
CSG fastener)
Adds construction tabs to a given CSG object in order to facilitate
connection with other boards and returns the CSG with tabs added plus
separate fastener objects interspersed between tabs.
|
java.util.ArrayList<CSG> |
addTabs(Vector3d edgeDirection,
LengthParameter fastenerHoleDiameter) |
boolean |
checkGroupMembership(java.lang.String groupName) |
CSG |
clearExportFormats() |
CSG |
clone() |
CSG |
color(javafx.scene.paint.Color c)
Color.
|
CSG |
difference(CSG... csgs)
Return a new CSG solid representing the difference of this csg and the
specified csgs.
|
CSG |
difference(CSG csg)
Return a new CSG solid representing the difference of this csg and the
specified csg.
|
CSG |
difference(java.util.List<CSG> csgs)
Return a new CSG solid representing the difference of this csg and the
specified csgs.
|
CSG |
dumbUnion(CSG csg)
Returns a csg consisting of the polygons of this csg and the specified csg.
|
static CSG |
fromPolygons(java.util.List<Polygon> polygons)
Constructs a CSG from a list of
Polygon instances. |
static CSG |
fromPolygons(Polygon... polygons)
Constructs a CSG from the specified
Polygon instances. |
static CSG |
fromPolygons(PropertyStorage storage,
java.util.List<Polygon> polygons)
Constructs a CSG from a list of
Polygon instances. |
static CSG |
fromPolygons(PropertyStorage storage,
Polygon... polygons)
Constructs a CSG from the specified
Polygon instances. |
PropertyStorage |
getAssemblyStorage() |
CSG |
getBoundingBox()
Get Bounding box
|
Bounds |
getBounds()
Returns the bounds of this csg.
|
Vector3d |
getCenter() |
Transform |
getCenterOfMass() |
double |
getCenterX()
Helper function wrapping bounding box values
|
double |
getCenterY()
Helper function wrapping bounding box values
|
double |
getCenterZ()
Helper function wrapping bounding box values
|
javafx.scene.paint.Color |
getColor()
Gets the color.
|
java.util.ArrayList<java.lang.String> |
getCreationEventStackTraceList() |
javafx.scene.shape.MeshView |
getCurrentMeshView() |
java.util.ArrayList<Transform> |
getDatumReferences() |
static javafx.scene.paint.Color |
getDefaultColor() |
java.util.ArrayList<java.lang.String> |
getExportFormats() |
javafx.scene.transform.Affine |
getManipulator() |
PrepForManufacturing |
getManufacturing() |
java.util.HashMap<java.lang.String,IParametric> |
getMapOfparametrics() |
double |
getMassKG(double mass) |
double |
getMaxX()
Helper function wrapping bounding box values
|
double |
getMaxY()
Helper function wrapping bounding box values
|
double |
getMaxZ()
Helper function wrapping bounding box values
|
javafx.scene.shape.MeshView |
getMesh()
Gets the mesh.
|
PrepForManufacturing |
getMfg() |
static int |
getMinPolygonsForOffloading() |
double |
getMinX()
Helper function wrapping bounding box values
|
double |
getMinY()
Helper function wrapping bounding box values
|
double |
getMinZ()
Helper function wrapping bounding box values
|
java.lang.String |
getName() |
static int |
getNumfacesinoffset() |
static int |
getNumFacesInOffset() |
protected CSG.OptType |
getOptType()
Gets the opt type.
|
java.util.Set<java.lang.String> |
getParameters() |
java.util.List<Polygon> |
getPolygons()
Gets the polygons.
|
int |
getPrintBedIndex() |
static ICSGProgress |
getProgressMoniter() |
IRegenerate |
getRegenerate() |
java.util.ArrayList<Transform> |
getSlicePlanes() |
PropertyStorage |
getStorage() |
double |
getTotalX()
Helper function wrapping bounding box values
|
double |
getTotalY()
Helper function wrapping bounding box values
|
double |
getTotalZ()
Helper function wrapping bounding box values
|
boolean |
hasMassSet() |
CSG |
historySync(CSG dyingCSG) |
CSG |
hull()
Returns the convex hull of this csg.
|
CSG |
hull(CSG... csgs)
Returns the convex hull of this csg and the union of the specified csgs.
|
CSG |
hull(java.util.List<CSG> csgs)
Returns the convex hull of this csg and the union of the specified csgs.
|
static CSG |
hullAll(CSG... csgs) |
static CSG |
hullAll(java.util.List<CSG> csgs) |
CSG |
intersect(CSG... csgs)
Return a new CSG solid representing the intersection of this csg and the
specified csgs.
|
CSG |
intersect(CSG csg)
Return a new CSG solid representing the intersection of this csg and the
specified csg.
|
CSG |
intersect(java.util.List<CSG> csgs)
Return a new CSG solid representing the intersection of this csg and the
specified csgs.
|
boolean |
isBoundsTouching(CSG incoming) |
boolean |
isGroupResult() |
boolean |
isHide() |
boolean |
isHole() |
boolean |
isInGroup() |
boolean |
isLock() |
boolean |
isMarkedForRegeneration() |
static boolean |
isPreventNonManifoldTriangles() |
static boolean |
isUseGPU() |
static boolean |
isUseStackTraces() |
boolean |
isWireFrame() |
CSG |
makeKeepaway(java.lang.Number sn) |
CSG |
markForRegeneration() |
java.util.ArrayList<CSG> |
mink(CSG travelingShape)
Shortened name In case you forget the name of minkowski
|
java.util.ArrayList<CSG> |
minkowski(CSG travelingShape)
This is a simplified version of a minkowski transform using convex hull and
the internal list of convex polygons The shape is placed at the vertex of
each point on a polygon, and the result is convex hulled together.
|
CSG |
minkowskiDifference(CSG itemToDifference,
CSG minkowskiObject)
minkowskiDifference performs an efficient difference of the minkowski
transform of the intersection of an object.
|
CSG |
minkowskiDifference(CSG itemToDifference,
double tolerance)
minkowskiDifference performs an efficient difference of the minkowski
transform of the intersection of an object.
|
java.util.ArrayList<CSG> |
minkowskiHullShape(CSG travelingShape)
This is a simplified version of a minkowski transform using convex hull and
the internal list of convex polygons The shape is placed at the vertex of
each point on a polygon, and the result is convex hulled together.
|
java.util.ArrayList<CSG> |
minovsky(CSG travelingShape)
Deprecated.
|
CSG |
mirrorx()
mirror about x axis.
|
CSG |
mirrory()
mirror about y axis.
|
CSG |
mirrorz()
mirror about z axis.
|
static java.util.ArrayList<CSG> |
move(java.util.ArrayList<CSG> slice,
java.util.ArrayList<Transform> p) |
java.util.ArrayList<CSG> |
move(java.util.ArrayList<Transform> p) |
CSG |
move(java.lang.Number[] posVector) |
CSG |
move(java.lang.Number x,
java.lang.Number y,
java.lang.Number z) |
CSG |
move(Vector3d v) |
CSG |
move(Vertex v) |
CSG |
moveToCenter()
Helper function moving CSG to center X, Y, Z moveToCenter.
|
CSG |
moveToCenterX()
Helper function moving CSG to center X moveToCenterX.
|
CSG |
moveToCenterY()
Helper function moving CSG to center Y moveToCenterY.
|
CSG |
moveToCenterZ()
Helper function moving CSG to center Z moveToCenterZ.
|
CSG |
movex(java.lang.Number howFarToMove)
Movex.
|
CSG |
movey(java.lang.Number howFarToMove)
Movey.
|
CSG |
movez(java.lang.Number howFarToMove)
Movez.
|
javafx.scene.shape.MeshView |
newMesh()
Gets the mesh.
|
CSG |
optimization(CSG.OptType type)
Defines the CSg optimization type.
|
CSG |
prepForManufacturing() |
CSG |
prepMfg() |
CSG |
regenerate() |
CSG |
removeGroupMembership(java.lang.String groupID) |
CSG |
removeIsGroupResult(java.lang.String res) |
CSG |
rot(java.lang.Number[] posVector) |
CSG |
rot(java.lang.Number x,
java.lang.Number y,
java.lang.Number z) |
CSG |
rotx(java.lang.Number degreesToRotate)
Rotx.
|
CSG |
roty(java.lang.Number degreesToRotate)
Roty.
|
CSG |
rotz(java.lang.Number degreesToRotate)
Rotz.
|
CSG |
scale(java.lang.Number scaleValue)
Scale.
|
CSG |
scaleToMeasurmentX(java.lang.Number measurment)
Scalex.
|
CSG |
scaleToMeasurmentY(java.lang.Number measurment)
Scaley.
|
CSG |
scaleToMeasurmentZ(java.lang.Number measurment) |
CSG |
scalex(java.lang.Number scaleValue)
Scalex.
|
CSG |
scaley(java.lang.Number scaleValue)
Scaley.
|
CSG |
scalez(java.lang.Number scaleValue)
Scalez.
|
CSG |
setCenterOfMass(double x,
double y,
double z) |
CSG |
setCenterOfMass(Transform com) |
CSG |
setColor(javafx.scene.paint.Color color)
Sets the color.
|
void |
setCurrentMeshView(javafx.scene.shape.MeshView current) |
static void |
setDefaultOptType(CSG.OptType optType)
Sets the default opt type.
|
CSG |
setIsHide(boolean Hide) |
CSG |
setIsHole(boolean hole) |
CSG |
setIsLock(boolean Lock) |
CSG |
setIsWireFrame(boolean b) |
CSG |
setManipulator(javafx.scene.transform.Affine manipulator)
Sets the manipulator.
|
CSG |
setManufacturing(PrepForManufacturing manufactuing) |
CSG |
setMassKG(double mass) |
void |
setMeshColor(javafx.scene.paint.Color color) |
CSG |
setMfg(PrepForManufacturing manufactuing) |
static void |
setMinPolygonsForOffloading(int minPolygonsForOffloading) |
CSG |
setName(java.lang.String name) |
static void |
setNumFacesInOffset(int numFacesInOffset) |
CSG |
setOptType(CSG.OptType optType)
Sets the opt type.
|
CSG |
setParameter(Parameter w) |
CSG |
setParameter(Parameter w,
IParametric function) |
CSG |
setParameter(java.lang.String key,
double defaultValue,
double upperBound,
double lowerBound,
IParametric function) |
CSG |
setParameterIfNull(java.lang.String key) |
CSG |
setParameterNewValue(java.lang.String key,
double newValue) |
CSG |
setPolygons(java.util.List<Polygon> polygons)
Sets the polygons.
|
static void |
setPreventNonManifoldTriangles(boolean preventNonManifoldTriangles) |
CSG |
setPrintBedNumber(int index) |
static void |
setProgressMoniter(ICSGProgress progressMoniter) |
CSG |
setRegenerate(IRegenerate function) |
CSG |
setStorage(PropertyStorage storage) |
CSG |
setTemporaryColor(javafx.scene.paint.Color color)
Sets the Temporary color.
|
static void |
setUseGPU(boolean useGPU) |
static void |
setUseStackTraces(boolean useStackTraces) |
CSG |
syncProperties(CSG dying) |
static java.util.List<CSG> |
tessellate(CSG incoming,
int steps)
Tessellates a given CSG object into a 3D grid with specified steps.
|
static java.util.List<CSG> |
tessellate(CSG incoming,
int steps,
double gridSpacing)
Tessellates a given CSG object into a 3D grid with specified steps and
uniform grid spacing.
|
static java.util.List<CSG> |
tessellate(CSG incoming,
int xSteps,
int ySteps,
int zSteps)
Tessellates a given CSG object into a 3D grid with specified steps.
|
static java.util.List<CSG> |
tessellate(CSG incoming,
int xSteps,
int ySteps,
int zSteps,
double xGrid,
double yGrid,
double zGrid,
double[][] offsets)
Tessellates a given CSG object into a 3D grid with specified steps, grid
spacing, and a 3D array of offsets for odd rows, columns, and layers.
|
static java.util.List<CSG> |
tessellate(CSG incoming,
int xSteps,
int ySteps,
int zSteps,
double oddRowXOffset,
double oddRowYOffset,
double oddRowZOffset,
double oddColXOffset,
double oddColYOffset,
double oddColZOffset,
double oddLayXOffset,
double oddLayYOffset,
double oddLayZOffset)
Tessellates a given CSG object into a 3D grid with specified steps and
offsets for odd rows, columns, and layers.
|
static java.util.List<CSG> |
tessellate(CSG incoming,
int xSteps,
int ySteps,
int zSteps,
double xGrid,
double yGrid,
double zGrid,
double oddRowXOffset,
double oddRowYOffset,
double oddRowZOffset,
double oddColXOffset,
double oddColYOffset,
double oddColZOffset,
double oddLayXOffset,
double oddLayYOffset,
double oddLayZOffset)
Tessellates a given CSG object into a 3D grid with specified steps and grid
spacing, including offsets for odd rows, columns, and layers.
|
static java.util.List<CSG> |
tessellateXY(CSG incoming,
int xSteps,
int ySteps)
Tessellates a given CSG object into a 2D grid with specified steps.
|
static java.util.List<CSG> |
tessellateXY(CSG incoming,
int xSteps,
int ySteps,
double xGrid,
double yGrid)
Tessellates a given CSG object into a 2D grid with specified steps and grid
spacing.
|
static java.util.List<CSG> |
tessellateXY(CSG incoming,
int xSteps,
int ySteps,
double xGrid,
double yGrid,
double[][] offsets)
Tessellates a given CSG object into a 2D grid with specified steps, grid
spacing, and a 2D array of offsets for odd rows and columns.
|
static java.util.List<CSG> |
tessellateXY(CSG incoming,
int xSteps,
int ySteps,
double xGrid,
double yGrid,
double oddRowXOffset,
double oddRowYOffset,
double oddColXOffset,
double oddColYOffset)
Tessellates a given CSG object into a 2D grid with specified steps and grid
spacing, including offsets for odd rows and columns.
|
static CSG |
text(java.lang.String text,
double height) |
static CSG |
text(java.lang.String text,
double height,
double fontSize) |
static CSG |
text(java.lang.String text,
double height,
double fontSize,
java.lang.String fontType) |
static CSG |
textToSize(java.lang.String text,
double x,
double y,
double z)
Extrude text to a specific bounding box size
|
MeshContainer |
toJavaFXMesh(CadInteractionEvent interact)
To java fx mesh.
|
MeshContainer |
toJavaFXMeshSimple(CadInteractionEvent interact)
Returns the CSG as JavaFX triangle mesh.
|
java.lang.String |
toObjString()
Returns this csg in OBJ string format.
|
java.lang.StringBuilder |
toObjString(java.lang.StringBuilder sb)
Returns this csg in OBJ string format.
|
CSG |
toolOffset(java.lang.Number sn) |
java.lang.String |
toStlString()
Returns this csg in STL string format.
|
java.lang.StringBuilder |
toStlString(java.lang.StringBuilder sb)
Returns this csg in STL string format.
|
java.lang.String |
toString() |
boolean |
touching(CSG incoming)
A test to see if 2 CSG's are touching.
|
CSG |
toXMax()
To x max.
|
CSG |
toXMax(CSG target)
To x max.
|
CSG |
toXMin()
To x min.
|
CSG |
toXMin(CSG target)
To x min.
|
CSG |
toYMax()
To y max.
|
CSG |
toYMax(CSG target)
To y max.
|
CSG |
toYMin()
To y min.
|
CSG |
toYMin(CSG target)
To y min.
|
CSG |
toZMax()
To z max.
|
CSG |
toZMax(CSG target)
To z max.
|
CSG |
toZMin()
To z min.
|
CSG |
toZMin(CSG target)
To z min.
|
CSG |
transformed(Transform transform)
Returns a transformed copy of this CSG.
|
CSG |
triangulate() |
CSG |
triangulate(boolean fix) |
CSG |
union(CSG... csgs)
Return a new CSG solid representing the union of this csg and the specified
csgs.
|
CSG |
union(CSG csg)
Return a new CSG solid representing the union of this csg and the specified
csg.
|
CSG |
union(java.util.List<CSG> csgs)
Return a new CSG solid representing the union of this csg and the specified
csgs.
|
static CSG |
unionAll(CSG... csgs) |
static CSG |
unionAll(java.util.List<CSG> csgs) |
CSG |
weighted(WeightFunction f)
Weighted.
|
public static final int INDEX_OF_PARAMETRIC_DEFAULT
public static final int INDEX_OF_PARAMETRIC_LOWER
public static final int INDEX_OF_PARAMETRIC_UPPER
public CSG prepForManufacturing()
public javafx.scene.paint.Color getColor()
public CSG setColor(javafx.scene.paint.Color color)
color - the new colorpublic void setMeshColor(javafx.scene.paint.Color color)
public CSG setTemporaryColor(javafx.scene.paint.Color color)
color - the new Temporary colorpublic CSG setManipulator(javafx.scene.transform.Affine manipulator)
manipulator - the manipulatorpublic javafx.scene.shape.MeshView getMesh()
public javafx.scene.shape.MeshView newMesh()
public CSG toZMin()
public CSG toZMax()
public CSG toXMin()
public CSG toXMax()
public CSG toYMin()
public CSG toYMax()
public CSG move(java.lang.Number x, java.lang.Number y, java.lang.Number z)
public CSG move(java.lang.Number[] posVector)
public CSG movey(java.lang.Number howFarToMove)
howFarToMove - the how far to movepublic CSG movez(java.lang.Number howFarToMove)
howFarToMove - the how far to movepublic CSG movex(java.lang.Number howFarToMove)
howFarToMove - the how far to movepublic CSG moveToCenterX()
public CSG moveToCenterY()
public CSG moveToCenterZ()
public CSG moveToCenter()
public static java.util.ArrayList<CSG> move(java.util.ArrayList<CSG> slice, java.util.ArrayList<Transform> p)
public CSG mirrory()
public CSG mirrorz()
public CSG mirrorx()
public CSG rot(java.lang.Number x, java.lang.Number y, java.lang.Number z)
public CSG rot(java.lang.Number[] posVector)
public CSG rotz(java.lang.Number degreesToRotate)
degreesToRotate - the degrees to rotatepublic CSG roty(java.lang.Number degreesToRotate)
degreesToRotate - the degrees to rotatepublic CSG rotx(java.lang.Number degreesToRotate)
degreesToRotate - the degrees to rotatepublic CSG scalez(java.lang.Number scaleValue)
scaleValue - the scale valuepublic CSG scaley(java.lang.Number scaleValue)
scaleValue - the scale valuepublic CSG scalex(java.lang.Number scaleValue)
scaleValue - the scale valuepublic CSG scaleToMeasurmentZ(java.lang.Number measurment)
public CSG scaleToMeasurmentY(java.lang.Number measurment)
measurment - the scale valuepublic CSG scaleToMeasurmentX(java.lang.Number measurment)
measurment - the scale valuepublic CSG scale(java.lang.Number scaleValue)
scaleValue - the scale valuepublic static CSG fromPolygons(java.util.List<Polygon> polygons)
Polygon instances.polygons - polygonspublic static CSG fromPolygons(Polygon... polygons)
Polygon instances.polygons - polygonspublic static CSG fromPolygons(PropertyStorage storage, java.util.List<Polygon> polygons)
Polygon instances.storage - shared storagepolygons - polygonspublic static CSG fromPolygons(PropertyStorage storage, Polygon... polygons)
Polygon instances.storage - shared storagepolygons - polygonspublic CSG clone()
clone in class java.lang.Objectpublic java.util.List<Polygon> getPolygons()
public CSG optimization(CSG.OptType type)
type - optimization typepublic CSG union(CSG csg)
Note: Neither this csg nor the specified csg are weighted.
A.union(B)
+-------+ +-------+
| | | |
| A | | |
| +--+----+ = | +----+
+----+--+ | +----+ |
| B | | |
| | | |
+-------+ +-------+
csg - other csgpublic CSG dumbUnion(CSG csg)
The purpose of this method is to allow fast union operations for objects that do not intersect.
WARNING: this method does not apply the csg algorithms. Therefore, please ensure that this csg and the specified csg do not intersect.
csg - csgpublic CSG union(java.util.List<CSG> csgs)
Note: Neither this csg nor the specified csg are weighted.
A.union(B)
+-------+ +-------+
| | | |
| A | | |
| +--+----+ = | +----+
+----+--+ | +----+ |
| B | | |
| | | |
+-------+ +-------+
csgs - other csgspublic CSG union(CSG... csgs)
Note: Neither this csg nor the specified csg are weighted.
A.union(B)
+-------+ +-------+
| | | |
| A | | |
| +--+----+ = | +----+
+----+--+ | +----+ |
| B | | |
| | | |
+-------+ +-------+
csgs - other csgspublic CSG hull()
public CSG hull(java.util.List<CSG> csgs)
csgs - csgspublic CSG hull(CSG... csgs)
csgs - csgspublic CSG difference(java.util.List<CSG> csgs)
Note: Neither this csg nor the specified csgs are weighted.
A.difference(B)
+-------+ +-------+
| | | |
| A | | |
| +--+----+ = | +--+
+----+--+ | +----+
| B |
| |
+-------+
csgs - other csgspublic CSG difference(CSG... csgs)
Note: Neither this csg nor the specified csgs are weighted.
A.difference(B)
+-------+ +-------+
| | | |
| A | | |
| +--+----+ = | +--+
+----+--+ | +----+
| B |
| |
+-------+
csgs - other csgspublic CSG difference(CSG csg)
Note: Neither this csg nor the specified csg are weighted.
A.difference(B)
+-------+ +-------+
| | | |
| A | | |
| +--+----+ = | +--+
+----+--+ | +----+
| B |
| |
+-------+
csg - other csgpublic CSG intersect(CSG csg)
Note: Neither this csg nor the specified csg are weighted.
A.intersect(B)
+-------+
| |
| A |
| +--+----+ = +--+
+----+--+ | +--+
| B |
| |
+-------+
}
csg - other csgpublic CSG intersect(java.util.List<CSG> csgs)
Note: Neither this csg nor the specified csgs are weighted.
A.intersect(B)
+-------+
| |
| A |
| +--+----+ = +--+
+----+--+ | +--+
| B |
| |
+-------+
}
csgs - other csgspublic CSG intersect(CSG... csgs)
Note: Neither this csg nor the specified csgs are weighted.
A.intersect(B)
+-------+
| |
| A |
| +--+----+ = +--+
+----+--+ | +--+
| B |
| |
+-------+
}
csgs - other csgspublic java.lang.String toStlString()
public java.lang.StringBuilder toStlString(java.lang.StringBuilder sb)
sb - string builderpublic CSG triangulate()
public CSG triangulate(boolean fix)
public CSG color(javafx.scene.paint.Color c)
c - the cpublic java.lang.StringBuilder toObjString(java.lang.StringBuilder sb)
sb - string builderpublic java.lang.String toObjString()
public CSG weighted(WeightFunction f)
f - the fpublic CSG transformed(Transform transform)
transform - the transform to applypublic MeshContainer toJavaFXMesh(CadInteractionEvent interact)
interact - the interactpublic MeshContainer toJavaFXMeshSimple(CadInteractionEvent interact)
interact - the interactpublic Bounds getBounds()
public Vector3d getCenter()
public double getCenterX()
public double getCenterY()
public double getCenterZ()
public double getMaxX()
public double getMaxY()
public double getMaxZ()
public double getMinX()
public double getMinY()
public double getMinZ()
public double getTotalX()
public double getTotalY()
public double getTotalZ()
protected CSG.OptType getOptType()
public static void setDefaultOptType(CSG.OptType optType)
optType - the optType to setpublic CSG setOptType(CSG.OptType optType)
optType - the optType to setpublic CSG setPolygons(java.util.List<Polygon> polygons)
polygons - the new polygons@Deprecated public java.util.ArrayList<CSG> minovsky(CSG travelingShape)
travelingShape - public java.util.ArrayList<CSG> mink(CSG travelingShape)
travelingShape - public java.util.ArrayList<CSG> minkowskiHullShape(CSG travelingShape)
travelingShape - a shape to sweep aroundpublic java.util.ArrayList<CSG> minkowski(CSG travelingShape)
travelingShape - a shape to sweep aroundpublic CSG minkowskiDifference(CSG itemToDifference, CSG minkowskiObject)
itemToDifference - the object that needs to fitminkowskiObject - the object to represent the offsetpublic CSG minkowskiDifference(CSG itemToDifference, double tolerance)
itemToDifference - the object that needs to fittolerance - the tolerance distancepublic CSG toolOffset(java.lang.Number sn)
public CSG makeKeepaway(java.lang.Number sn)
public javafx.scene.transform.Affine getManipulator()
public CSG addCreationEventStackTraceList(java.util.ArrayList<java.lang.Exception> incoming)
public CSG addCreationEventStringList(java.util.ArrayList<java.lang.String> incoming)
public CSG addCreationEventString(java.lang.String thisline)
public java.util.ArrayList<java.lang.String> getCreationEventStackTraceList()
public CSG prepMfg()
public PrepForManufacturing getManufacturing()
public PrepForManufacturing getMfg()
public CSG setMfg(PrepForManufacturing manufactuing)
public CSG setManufacturing(PrepForManufacturing manufactuing)
public CSG setParameter(Parameter w, IParametric function)
public CSG setParameter(java.lang.String key, double defaultValue, double upperBound, double lowerBound, IParametric function)
public CSG setParameterIfNull(java.lang.String key)
public java.util.Set<java.lang.String> getParameters()
public CSG setParameterNewValue(java.lang.String key, double newValue)
public CSG setRegenerate(IRegenerate function)
public IRegenerate getRegenerate()
public CSG regenerate()
public java.util.HashMap<java.lang.String,IParametric> getMapOfparametrics()
public boolean isMarkedForRegeneration()
public CSG markForRegeneration()
public boolean touching(CSG incoming)
incoming - public static ICSGProgress getProgressMoniter()
public static void setProgressMoniter(ICSGProgress progressMoniter)
public static javafx.scene.paint.Color getDefaultColor()
public CSG getBoundingBox()
public java.lang.String getName()
public CSG setName(java.lang.String name)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.ArrayList<Transform> getSlicePlanes()
public java.util.ArrayList<java.lang.String> getExportFormats()
public CSG clearExportFormats()
public CSG addExportFormat(java.lang.String exportFormat)
exportFormat - the exportFormat to addpublic static int getNumfacesinoffset()
public static int getNumFacesInOffset()
public static void setNumFacesInOffset(int numFacesInOffset)
public static boolean isUseStackTraces()
public static void setUseStackTraces(boolean useStackTraces)
public java.util.ArrayList<Transform> getDatumReferences()
public PropertyStorage getStorage()
public CSG setStorage(PropertyStorage storage)
public java.util.ArrayList<CSG> addTabs(Vector3d edgeDirection, CSG fastener) throws java.lang.Exception
TODO: Find the polygon defined by the XY plane slice that is perhaps 0.5mm into the normalized +Y. Add tabs to THAT polygon's minX/maxX instead of part's global minX/maxX.
Example usage: // Create a temporary copy of the target object, without any tabs CSG boardTemp = board
// Instantiate a bucket to hold fastener CSG objects in ArrayList
// Define the direction of the edge to be tabbed using a Vector3d object, in
this case the edge facing in the negative Y direction Vector3d edgeDirection
= new Vector3d(0, -1, 0);
// Define the diameter of the fastener holes to be added using a
LengthParameter object LengthParameter screwDiameter = new
LengthParameter("Screw Hole Diameter (mm)", 3, [0, 20])
// Add tabs to the temporary object using the edgeDirection and screwDiameter
parameters ArrayList
// Combine the modified temporary object with the original object, to add the
new tabs board = boardTemp.union(returned.get(0));
// Add the separate fastener hole objects to the list fasteners =
returned.subList(1, returned.size());
edgeDirection - a Vector3d object representing the direction of the edge
of the board to which tabs and fastener holes will be
addedfastener - a CSG object representing a template fastener to be
added between the tabsjava.lang.Exception - if the edgeDirection parameter is not a cartesian unit
Vector3d object or uses an unimplemented orientationpublic java.util.ArrayList<CSG> addTabs(Vector3d edgeDirection, LengthParameter fastenerHoleDiameter) throws java.lang.Exception
java.lang.Exceptionpublic PropertyStorage getAssemblyStorage()
public boolean isWireFrame()
public CSG setIsWireFrame(boolean b)
public CSG setPrintBedNumber(int index)
public int getPrintBedIndex()
public static CSG text(java.lang.String text, double height, double fontSize)
public static CSG text(java.lang.String text, double height)
public static CSG text(java.lang.String text, double height, double fontSize, java.lang.String fontType)
public static CSG textToSize(java.lang.String text, double x, double y, double z)
text - the text to be extrudedx - the total final Xy - the total final Yz - the total final Zpublic boolean hasMassSet()
public CSG setMassKG(double mass)
public double getMassKG(double mass)
public CSG setCenterOfMass(double x, double y, double z)
public Transform getCenterOfMass()
public CSG addGroupMembership(java.lang.String groupID)
public CSG removeGroupMembership(java.lang.String groupID)
public boolean isInGroup()
public boolean checkGroupMembership(java.lang.String groupName)
public CSG addIsGroupResult(java.lang.String res)
public CSG removeIsGroupResult(java.lang.String res)
public boolean isGroupResult()
public CSG setIsLock(boolean Lock)
public boolean isLock()
public CSG setIsHide(boolean Hide)
public boolean isHide()
public CSG setIsHole(boolean hole)
public boolean isHole()
public static java.util.List<CSG> tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.zSteps - Number of steps (iterations) in the z-direction.xGrid - Distance between iterations in the x-direction.yGrid - Distance between iterations in the y-direction.zGrid - Distance between iterations in the z-direction.oddRowXOffset - X offset for odd rows.oddRowYOffset - Y offset for odd rows.oddRowZOffset - Z offset for odd rows.oddColXOffset - X offset for odd columns.oddColYOffset - Y offset for odd columns.oddColZOffset - Z offset for odd columns.oddLayXOffset - X offset for odd layers.oddLayYOffset - Y offset for odd layers.oddLayZOffset - Z offset for odd layers.public static java.util.List<CSG> tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double xGrid, double yGrid, double zGrid, double[][] offsets)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.zSteps - Number of steps (iterations) in the z-direction.xGrid - Distance between iterations in the x-direction.yGrid - Distance between iterations in the y-direction.zGrid - Distance between iterations in the z-direction.offsets - 3D array of offsets for odd rows, columns, and layers.public static java.util.List<CSG> tessellate(CSG incoming, int xSteps, int ySteps, int zSteps)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.zSteps - Number of steps (iterations) in the z-direction.public static java.util.List<CSG> tessellate(CSG incoming, int xSteps, int ySteps, int zSteps, double oddRowXOffset, double oddRowYOffset, double oddRowZOffset, double oddColXOffset, double oddColYOffset, double oddColZOffset, double oddLayXOffset, double oddLayYOffset, double oddLayZOffset)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.zSteps - Number of steps (iterations) in the z-direction.oddRowXOffset - X offset for odd rows.oddRowYOffset - Y offset for odd rows.oddRowZOffset - Z offset for odd rows.oddColXOffset - X offset for odd columns.oddColYOffset - Y offset for odd columns.oddColZOffset - Z offset for odd columns.oddLayXOffset - X offset for odd layers.oddLayYOffset - Y offset for odd layers.oddLayZOffset - Z offset for odd layers.public static java.util.List<CSG> tessellate(CSG incoming, int steps, double gridSpacing)
incoming - The CSG object to be tessellated.steps - Number of steps (iterations) in each direction (x, y, z).gridSpacing - Distance between iterations in all directions (x, y, z).public static java.util.List<CSG> tessellate(CSG incoming, int steps)
incoming - The CSG object to be tessellated.steps - Number of steps (iterations) in each direction (x, y, z).public static java.util.List<CSG> tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid, double oddRowXOffset, double oddRowYOffset, double oddColXOffset, double oddColYOffset)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.xGrid - Distance between iterations in the x-direction.yGrid - Distance between iterations in the y-direction.oddRowXOffset - X offset for odd rows.oddRowYOffset - Y offset for odd rows.oddColXOffset - X offset for odd columns.oddColYOffset - Y offset for odd columns.public static java.util.List<CSG> tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid, double[][] offsets)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.xGrid - Distance between iterations in the x-direction.yGrid - Distance between iterations in the y-direction.offsets - 2D array of offsets for odd rows and columns.public static java.util.List<CSG> tessellateXY(CSG incoming, int xSteps, int ySteps)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.public static java.util.List<CSG> tessellateXY(CSG incoming, int xSteps, int ySteps, double xGrid, double yGrid)
incoming - The CSG object to be tessellated.xSteps - Number of steps (iterations) in the x-direction.ySteps - Number of steps (iterations) in the y-direction.xGrid - Distance between iterations in the x-direction.yGrid - Distance between iterations in the y-direction.public static boolean isPreventNonManifoldTriangles()
public static void setPreventNonManifoldTriangles(boolean preventNonManifoldTriangles)
public static boolean isUseGPU()
public static void setUseGPU(boolean useGPU)
public boolean isBoundsTouching(CSG incoming)
public static int getMinPolygonsForOffloading()
public static void setMinPolygonsForOffloading(int minPolygonsForOffloading)
public javafx.scene.shape.MeshView getCurrentMeshView()
public void setCurrentMeshView(javafx.scene.shape.MeshView current)