public class PolyhedronsSet extends AbstractRegion<Euclidean3D,Euclidean2D>
| Modifier and Type | Class and Description |
|---|---|
private class |
PolyhedronsSet.FacetsContributionVisitor
Visitor computing geometrical properties.
|
private static class |
PolyhedronsSet.RotationTransform
3D rotation as a Transform.
|
private static class |
PolyhedronsSet.TranslationTransform
3D translation as a transform.
|
Region.Location| Modifier and Type | Field and Description |
|---|---|
private static double |
DEFAULT_TOLERANCE
Default value for tolerance.
|
| Constructor and Description |
|---|
PolyhedronsSet()
Deprecated.
as of 3.3, replaced with
PolyhedronsSet(double) |
PolyhedronsSet(BSPTree<Euclidean3D> tree)
Deprecated.
as of 3.3, replaced with
PolyhedronsSet(BSPTree, double) |
PolyhedronsSet(BSPTree<Euclidean3D> tree,
double tolerance)
Build a polyhedrons set from a BSP tree.
|
PolyhedronsSet(java.util.Collection<SubHyperplane<Euclidean3D>> boundary)
Deprecated.
as of 3.3, replaced with
PolyhedronsSet(Collection, double) |
PolyhedronsSet(java.util.Collection<SubHyperplane<Euclidean3D>> boundary,
double tolerance)
Build a polyhedrons set from a Boundary REPresentation (B-rep) specified by sub-hyperplanes.
|
PolyhedronsSet(double tolerance)
Build a polyhedrons set representing the whole real line.
|
PolyhedronsSet(double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax)
Deprecated.
as of 3.3, replaced with
PolyhedronsSet(double, double,
double, double, double, double, double) |
PolyhedronsSet(double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax,
double tolerance)
Build a parallellepipedic box.
|
PolyhedronsSet(java.util.List<Vector3D> vertices,
java.util.List<int[]> facets,
double tolerance)
Build a polyhedrons set from a Boundary REPresentation (B-rep) specified by connected vertices.
|
| Modifier and Type | Method and Description |
|---|---|
private SubHyperplane<Euclidean3D> |
boundaryFacet(Vector3D point,
BSPTree<Euclidean3D> node)
Check if a point belongs to the boundary part of a node.
|
private static BSPTree<Euclidean3D> |
buildBoundary(double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax,
double tolerance)
Build a parallellepipedic box boundary.
|
private static java.util.List<SubHyperplane<Euclidean3D>> |
buildBoundary(java.util.List<Vector3D> vertices,
java.util.List<int[]> facets,
double tolerance)
Build boundary from vertices and facets.
|
PolyhedronsSet |
buildNew(BSPTree<Euclidean3D> tree)
Build a region using the instance as a prototype.
|
protected void |
computeGeometricalProperties()
Compute some geometrical properties.
|
private static int[][] |
findReferences(java.util.List<Vector3D> vertices,
java.util.List<int[]> facets)
Find the facets that reference each edges.
|
SubHyperplane<Euclidean3D> |
firstIntersection(Vector3D point,
Line line)
Get the first sub-hyperplane crossed by a semi-infinite line.
|
private SubHyperplane<Euclidean3D> |
recurseFirstIntersection(BSPTree<Euclidean3D> node,
Vector3D point,
Line line)
Get the first sub-hyperplane crossed by a semi-infinite line.
|
PolyhedronsSet |
rotate(Vector3D center,
Rotation rotation)
Rotate the region around the specified point.
|
private static int[][] |
successors(java.util.List<Vector3D> vertices,
java.util.List<int[]> facets,
int[][] references)
Find the successors of all vertices among all facets they belong to.
|
PolyhedronsSet |
translate(Vector3D translation)
Translate the region by the specified amount.
|
applyTransform, checkPoint, checkPoint, checkPoint, checkPoint, contains, copySelf, getBarycenter, getBoundarySize, getSize, getTolerance, getTree, intersection, isEmpty, isEmpty, isFull, isFull, projectToBoundary, setBarycenter, setBarycenter, setSize, sideprivate static final double DEFAULT_TOLERANCE
public PolyhedronsSet(double tolerance)
tolerance - tolerance below which points are considered identicalpublic PolyhedronsSet(BSPTree<Euclidean3D> tree, double tolerance)
The leaf nodes of the BSP tree must have a
Boolean attribute representing the inside status of
the corresponding cell (true for inside cells, false for outside
cells). In order to avoid building too many small objects, it is
recommended to use the predefined constants
Boolean.TRUE and Boolean.FALSE
This constructor is aimed at expert use, as building the tree may
be a difficult task. It is not intended for general use and for
performances reasons does not check thoroughly its input, as this would
require walking the full tree each time. Failing to provide a tree with
the proper attributes, will therefore generate problems like
NullPointerException or ClassCastException only later on.
This limitation is known and explains why this constructor is for expert
use only. The caller does have the responsibility to provided correct arguments.
tree - inside/outside BSP tree representing the regiontolerance - tolerance below which points are considered identicalpublic PolyhedronsSet(java.util.Collection<SubHyperplane<Euclidean3D>> boundary, double tolerance)
The boundary is provided as a collection of sub-hyperplanes. Each sub-hyperplane has the
interior part of the region on its minus side and the exterior on
its plus side.
The boundary elements can be in any order, and can form
several non-connected sets (like for example polyhedrons with holes
or a set of disjoint polyhedrons considered as a whole). In
fact, the elements do not even need to be connected together
(their topological connections are not used here). However, if the
boundary does not really separate an inside open from an outside
open (open having here its topological meaning), then subsequent
calls to the checkPoint method will
not be meaningful anymore.
If the boundary is empty, the region will represent the whole space.
boundary - collection of boundary elements, as a
collection of SubHyperplane objectstolerance - tolerance below which points are considered identicalpublic PolyhedronsSet(java.util.List<Vector3D> vertices, java.util.List<int[]> facets, double tolerance)
The boundary is provided as a list of vertices and a list of facets. Each facet is specified as an integer array containing the arrays vertices indices in the vertices list. Each facet normal is oriented by right hand rule to the facet vertices list.
Some basic sanity checks are performed but not everything is thoroughly assessed, so it remains under caller responsibility to ensure the vertices and facets are consistent and properly define a polyhedrons set.
vertices - list of polyhedrons set verticesfacets - list of facets, as vertices indices in the vertices listtolerance - tolerance below which points are considered identicalMathIllegalArgumentException - if some basic sanity checks failpublic PolyhedronsSet(double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax,
double tolerance)
xMin - low bound along the x directionxMax - high bound along the x directionyMin - low bound along the y directionyMax - high bound along the y directionzMin - low bound along the z directionzMax - high bound along the z directiontolerance - tolerance below which points are considered identical@Deprecated public PolyhedronsSet()
PolyhedronsSet(double)@Deprecated public PolyhedronsSet(BSPTree<Euclidean3D> tree)
PolyhedronsSet(BSPTree, double)The leaf nodes of the BSP tree must have a
Boolean attribute representing the inside status of
the corresponding cell (true for inside cells, false for outside
cells). In order to avoid building too many small objects, it is
recommended to use the predefined constants
Boolean.TRUE and Boolean.FALSE
tree - inside/outside BSP tree representing the region@Deprecated public PolyhedronsSet(java.util.Collection<SubHyperplane<Euclidean3D>> boundary)
PolyhedronsSet(Collection, double)The boundary is provided as a collection of sub-hyperplanes. Each sub-hyperplane has the
interior part of the region on its minus side and the exterior on
its plus side.
The boundary elements can be in any order, and can form
several non-connected sets (like for example polyhedrons with holes
or a set of disjoint polyhedrons considered as a whole). In
fact, the elements do not even need to be connected together
(their topological connections are not used here). However, if the
boundary does not really separate an inside open from an outside
open (open having here its topological meaning), then subsequent
calls to the checkPoint method will
not be meaningful anymore.
If the boundary is empty, the region will represent the whole space.
boundary - collection of boundary elements, as a
collection of SubHyperplane objects@Deprecated
public PolyhedronsSet(double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax)
PolyhedronsSet(double, double,
double, double, double, double, double)xMin - low bound along the x directionxMax - high bound along the x directionyMin - low bound along the y directionyMax - high bound along the y directionzMin - low bound along the z directionzMax - high bound along the z directionprivate static BSPTree<Euclidean3D> buildBoundary(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax, double tolerance)
xMin - low bound along the x directionxMax - high bound along the x directionyMin - low bound along the y directionyMax - high bound along the y directionzMin - low bound along the z directionzMax - high bound along the z directiontolerance - tolerance below which points are considered identicalprivate static java.util.List<SubHyperplane<Euclidean3D>> buildBoundary(java.util.List<Vector3D> vertices, java.util.List<int[]> facets, double tolerance)
vertices - list of polyhedrons set verticesfacets - list of facets, as vertices indices in the vertices listtolerance - tolerance below which points are considered identicalMathIllegalArgumentException - if some basic sanity checks failprivate static int[][] findReferences(java.util.List<Vector3D> vertices, java.util.List<int[]> facets)
vertices - list of polyhedrons set verticesfacets - list of facets, as vertices indices in the vertices listMathIllegalArgumentException - if some facets have fewer than 3 verticesprivate static int[][] successors(java.util.List<Vector3D> vertices, java.util.List<int[]> facets, int[][] references)
vertices - list of polyhedrons set verticesfacets - list of facets, as vertices indices in the vertices listreferences - facets references arrayMathIllegalArgumentException - if the same vertex appears more than
once in the successors list (which means one facet orientation is wrong)public PolyhedronsSet buildNew(BSPTree<Euclidean3D> tree)
This method allow to create new instances without knowing exactly the type of the region. It is an application of the prototype design pattern.
The leaf nodes of the BSP tree must have a
Boolean attribute representing the inside status of
the corresponding cell (true for inside cells, false for outside
cells). In order to avoid building too many small objects, it is
recommended to use the predefined constants
Boolean.TRUE and Boolean.FALSE. The
tree also must have either null internal nodes or
internal nodes representing the boundary as specified in the
getTree method).
buildNew in interface Region<Euclidean3D>buildNew in class AbstractRegion<Euclidean3D,Euclidean2D>tree - inside/outside BSP tree representing the new regionprotected void computeGeometricalProperties()
The properties to compute are the barycenter and the size.
computeGeometricalProperties in class AbstractRegion<Euclidean3D,Euclidean2D>public SubHyperplane<Euclidean3D> firstIntersection(Vector3D point, Line line)
point - start point of the part of the line consideredline - line to consider (contains point)private SubHyperplane<Euclidean3D> recurseFirstIntersection(BSPTree<Euclidean3D> node, Vector3D point, Line line)
node - current nodepoint - start point of the part of the line consideredline - line to consider (contains point)private SubHyperplane<Euclidean3D> boundaryFacet(Vector3D point, BSPTree<Euclidean3D> node)
point - point to checknode - node containing the boundary facet to checkpublic PolyhedronsSet rotate(Vector3D center, Rotation rotation)
The instance is not modified, a new instance is created.
center - rotation centerrotation - vectorial rotation operatorpublic PolyhedronsSet translate(Vector3D translation)
The instance is not modified, a new instance is created.
translation - translation to applyCopyright (c) 2003-2015 Apache Software Foundation