public class SurfaceMeshIntersector
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SurfaceMeshIntersector.CSG
Describes CSG and intersection operations between two meshes,
mesh0 and mesh1 . |
static class |
SurfaceMeshIntersector.RegionType
Describes which penetration regions should be computed for
a particular mesh intersecting with another mesh.
|
Modifier and Type | Field and Description |
---|---|
boolean |
coincidentError |
static boolean |
debug |
static boolean |
debug2 |
static RigidTransform3d |
debugTBW |
boolean |
mySilentP |
static int |
numClosestIntersectionCalls |
static int |
numEdgeAdds |
static int |
numRegularCalls |
static int |
numRobustCalls |
static int |
numRobustClosestIntersectionCalls |
boolean |
triangulationError |
static boolean |
writeErrorFiles |
Constructor and Description |
---|
SurfaceMeshIntersector() |
Modifier and Type | Method and Description |
---|---|
Vertex3d |
addEmptyFaceVertices(Vertex3dList poly,
HalfEdge edge,
IntersectionPoint emip,
IntersectionPoint xmip,
PenetrationRegion region,
Vertex3d curVtx,
boolean clockwise,
boolean debug) |
PolygonalMesh |
createCSGMesh(ContactInfo cinfo)
Computes the boundary mesh formed by the union of the penetration
regions associated with two meshes.
|
PolygonalMesh |
createCSGMeshOld(ContactInfo cinfo) |
HalfEdge |
edgeIntersectingFace(Face face,
Face otherFace,
IntersectionContour contour) |
java.util.ArrayList<IntersectionContour> |
findContours(PolygonalMesh mesh0,
PolygonalMesh mesh1) |
ContactInfo |
findContoursAndRegions(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Finds the intersection contours between two meshes, as described by
findContours(maspack.geometry.PolygonalMesh, maspack.geometry.PolygonalMesh) , and then processes these further to determine
inside penetration regions on each mesh. |
ContactInfo |
findContoursAndRegions(PolygonalMesh mesh0,
SurfaceMeshIntersector.RegionType regions0,
PolygonalMesh mesh1,
SurfaceMeshIntersector.RegionType regions1)
Finds the intersection contours between two meshes, as described by
findContours(maspack.geometry.PolygonalMesh, maspack.geometry.PolygonalMesh) , and then processes these further to determine
either the inside or outside penetration regions for
each mesh. |
PolygonalMesh |
findDifference01(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral boundary of the CSG (constructive solid geometry)
difference of two meshes, given by
|
PolygonalMesh |
findDifference10(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral boundary of the CSG (constructive solid geometry)
difference of two meshes, given by
|
PolygonalMesh |
findIntersection(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral boundary of the CSG (constructive solid geometry)
intersection of two meshes.
|
int |
findIntersectionContours(java.util.ArrayList<IntersectionContour> contours,
Boundable[] elems0,
Boundable[] elems1,
boolean edgeOnMesh0)
Look for intersecting triangles in elems0 and elems1.
|
PolygonalMesh |
findMesh0Inside(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral portion of
mesh0 that is inside
the intersection region between mesh0 and mesh1 . |
PolygonalMesh |
findMesh0Outside(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral portion of
mesh0 that is outside
the intersection region between mesh0 and mesh1 . |
PolygonalMesh |
findMesh1Inside(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral portion of
mesh1 that is inside
the intersection region between mesh0 and mesh1 . |
PolygonalMesh |
findMesh1Outside(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral portion of
mesh1 that is outside
the intersection region between mesh0 and mesh1 . |
ContactInfo |
findRegions(SurfaceMeshIntersector.RegionType regions0,
SurfaceMeshIntersector.RegionType regions1)
Finds either the inside or outside penetration regions for
the meshes and contours associated with the most recent call to either
findContours(maspack.geometry.PolygonalMesh, maspack.geometry.PolygonalMesh) , findContoursAndRegions(PolygonalMesh,PolygonalMesh) , or findContoursAndRegions(PolygonalMesh,RegionType,PolygonalMesh,RegionType) . |
PolygonalMesh |
findUnion(PolygonalMesh mesh0,
PolygonalMesh mesh1)
Find the polyhedral boundary of the CSG (constructive solid geometry)
union of two meshes.
|
boolean |
getRemoveZeroAreaFaces()
Queries whether zero area faces should be removed when constructing CSG
primitives.
|
boolean |
getSilent() |
boolean |
getWriteErrorFiles() |
void |
setRemoveZeroAreaFaces(boolean enable)
Sets whether zero area faces should be removed when constructing CSG
primitives.
|
void |
setSilent(boolean silent) |
void |
setWriteErrorFiles(boolean enable) |
java.lang.String |
toString(IntersectionPoint p) |
java.lang.String |
toString(IntersectionPoint p,
RigidTransform3d T)
Comprehensive string representation of a mesh intersection point,
showing most relevant information.
|
public static boolean writeErrorFiles
public boolean mySilentP
public static boolean debug
public static boolean debug2
public static RigidTransform3d debugTBW
public boolean triangulationError
public boolean coincidentError
public static int numRegularCalls
public static int numRobustCalls
public static int numEdgeAdds
public static int numClosestIntersectionCalls
public static int numRobustClosestIntersectionCalls
public boolean getSilent()
public void setSilent(boolean silent)
public boolean getWriteErrorFiles()
public void setWriteErrorFiles(boolean enable)
public boolean getRemoveZeroAreaFaces()
setRemoveZeroAreaFaces(boolean)
.public void setRemoveZeroAreaFaces(boolean enable)
public java.lang.String toString(IntersectionPoint p)
public java.lang.String toString(IntersectionPoint p, RigidTransform3d T)
public java.util.ArrayList<IntersectionContour> findContours(PolygonalMesh mesh0, PolygonalMesh mesh1)
public ContactInfo findRegions(SurfaceMeshIntersector.RegionType regions0, SurfaceMeshIntersector.RegionType regions1)
findContours(maspack.geometry.PolygonalMesh, maspack.geometry.PolygonalMesh)
, findContoursAndRegions(PolygonalMesh,PolygonalMesh)
, or findContoursAndRegions(PolygonalMesh,RegionType,PolygonalMesh,RegionType)
.
The type of region (inside, outside, or none) that should be computed for
each mesh is controlled by the arguments regions0
and
regions1
. This method functions identically to findContoursAndRegions(PolygonalMesh,RegionType,PolygonalMesh,RegionType)
,
except that the meshes and contours are those associated with the last of
the aforementioned calls. If no such previous call was made, this method
throws an IllegalStateException
. If the call did not result in an
intersection, this method returns null
.regions0
- specifies which type of penetration regions should
be computed for the first meshregions1
- specifies which type of penetration regions should
be computed for the second meshContactInfo
structure containing the computed
region information, or null
if no intersection was
previously found.public ContactInfo findContoursAndRegions(PolygonalMesh mesh0, PolygonalMesh mesh1)
findContours(maspack.geometry.PolygonalMesh, maspack.geometry.PolygonalMesh)
, and then processes these further to determine
inside penetration regions on each mesh. This is
identical to the call
findContoursAndRegions (mesh0, true, mesh1, true);and for more information see the documentation for
findContoursAndRegions(PolygonalMesh,RegionType,PolygonalMesh,RegionType)
.mesh0
- first meshmesh1
- second meshContactInfo
object containing the contours and regions,
or null
if there is no intersection.public ContactInfo findContoursAndRegions(PolygonalMesh mesh0, SurfaceMeshIntersector.RegionType regions0, PolygonalMesh mesh1, SurfaceMeshIntersector.RegionType regions1)
findContours(maspack.geometry.PolygonalMesh, maspack.geometry.PolygonalMesh)
, and then processes these further to determine
either the inside or outside penetration regions for
each mesh. These are the sub-regions of the mesh which are either
inside
or outside
of the intersection
volume. The type of region (inside, outside, or none) that should
be computed for each mesh is controlled by the arguments
regions0
and regions1
.
Contours that do not partition a mesh into distinct regions are ignored.
The region information for each mesh, along with the generated
contours, is returned in a ContactInfo
object, for which the
methods ContactInfo.getContours()
, getRegions(0)
, and getRegions(1)
can be
used to query the contours and the respective regions for
mesh0
and mesh1
.
If no intersection contours are discovered between the two
meshes, the contour list returned in the ContactInfo
will have zero length.
mesh0
- first meshregions0
- specifies which type of penetration regions should
be computed for mesh0
mesh1
- second meshregions1
- specifies which type of penetration regions should
be computed for mesh1
ContactInfo
object containing the contours and regionspublic PolygonalMesh findIntersection(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh0
and mesh1
do not intersect.mesh0
- first intersecting meshmesh1
- second intersecting meshnull
if no such mesh exists.public PolygonalMesh findUnion(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh0
- first intersecting meshmesh1
- second intersecting meshpublic PolygonalMesh findDifference01(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh0 - mesh1The resulting mesh will be empty if
mesh0
is entirely inside mesh1
.mesh0
- first intersecting meshmesh1
- second intersecting meshpublic PolygonalMesh findDifference10(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh1 - mesh0The resulting mesh will be empty if
mesh1
is entirely inside mesh0
.mesh0
- first intersecting meshmesh1
- second intersecting meshpublic PolygonalMesh findMesh0Inside(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh0
that is inside
the intersection region between mesh0
and mesh1
.
The resulting mesh will be empty if the intersection results
in no closed intersection contours.mesh0
- first intersecting meshmesh1
- second intersecting meshmesh0
inside the intersectionpublic PolygonalMesh findMesh0Outside(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh0
that is outside
the intersection region between mesh0
and mesh1
.
The resulting mesh will be empty if the intersection results
in no closed intersection contours.mesh0
- first intersecting meshmesh1
- second intersecting meshmesh0
outside the intersectionpublic PolygonalMesh findMesh1Inside(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh1
that is inside
the intersection region between mesh0
and mesh1
.
The resulting mesh will be empty if the intersection results
in no closed intersection contours.mesh0
- first intersecting meshmesh1
- second intersecting meshmesh1
inside the intersectionpublic PolygonalMesh findMesh1Outside(PolygonalMesh mesh0, PolygonalMesh mesh1)
mesh1
that is outside
the intersection region between mesh0
and mesh1
.
The resulting mesh will be empty if the intersection results
in no closed intersection contours.mesh0
- first intersecting meshmesh1
- second intersecting meshmesh1
outside the intersectionpublic PolygonalMesh createCSGMesh(ContactInfo cinfo)
ContactInfo
object. These meshes and contours must also
correspond to those associated with the most recent intersection
contours computed by this intersector.
Whether or not the penetration regions for each mesh are "inside" or "outside" the opposite mesh determines the type of CSG volume produced:
mesh0 regions | mesh1 regions | CSG volume |
---|---|---|
inside | inside | intersection |
outside | outside | union |
outside | inside | difference (mesh0-mesh1) |
inside | outside | difference (mesh1-mesh0) |
inside | none | portion of mesh0 inside intersection |
outside | none | portion of mesh0 outside intersection |
none | inside | portion of mesh1 inside intersection |
none | outside | portion of mesh1 outside intersection |
cinfo
- meshes, contours and penetration regions from
which the CSG boundary is to be constructedjava.lang.IllegalStateException
- if the contours and meshes
do not match the contours most recently produced by this intersectorpublic PolygonalMesh createCSGMeshOld(ContactInfo cinfo)
public int findIntersectionContours(java.util.ArrayList<IntersectionContour> contours, Boundable[] elems0, Boundable[] elems1, boolean edgeOnMesh0)
public HalfEdge edgeIntersectingFace(Face face, Face otherFace, IntersectionContour contour)
public Vertex3d addEmptyFaceVertices(Vertex3dList poly, HalfEdge edge, IntersectionPoint emip, IntersectionPoint xmip, PenetrationRegion region, Vertex3d curVtx, boolean clockwise, boolean debug)