Class PolyhedronsSet
 java.lang.Object

 org.hipparchus.geometry.partitioning.AbstractRegion<Euclidean3D,Euclidean2D>

 org.hipparchus.geometry.euclidean.threed.PolyhedronsSet

 All Implemented Interfaces:
Region<Euclidean3D>
public class PolyhedronsSet extends AbstractRegion<Euclidean3D,Euclidean2D>
This class represents a 3D region: a set of polyhedrons.


Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PolyhedronsSet.BRep
Container for Boundary REPresentation (BRep).
Nested classes/interfaces inherited from interface org.hipparchus.geometry.partitioning.Region
Region.Location


Constructor Summary
Constructors Constructor Description 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, double tolerance)
Build a parallellepipedic box.PolyhedronsSet(Collection<SubHyperplane<Euclidean3D>> boundary, double tolerance)
Build a polyhedrons set from a Boundary REPresentation (Brep) specified by subhyperplanes.PolyhedronsSet(List<Vector3D> vertices, List<int[]> facets, double tolerance)
Build a polyhedrons set from a Boundary REPresentation (Brep) specified by connected vertices.PolyhedronsSet(PolyhedronsSet.BRep brep, double tolerance)
Build a polyhedrons set from a Boundary REPresentation (Brep) specified by connected vertices.PolyhedronsSet(BSPTree<Euclidean3D> tree, double tolerance)
Build a polyhedrons set from a BSP tree.

Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PolyhedronsSet
buildNew(BSPTree<Euclidean3D> tree)
Build a region using the instance as a prototype.protected void
computeGeometricalProperties()
Compute some geometrical properties.SubHyperplane<Euclidean3D>
firstIntersection(Vector3D point, Line line)
Get the first subhyperplane crossed by a semiinfinite line.PolyhedronsSet.BRep
getBRep()
Get the boundary representation of the instance.PolyhedronsSet
rotate(Vector3D center, Rotation rotation)
Rotate the region around the specified point.PolyhedronsSet
translate(Vector3D translation)
Translate the region by the specified amount.
Methods inherited from class org.hipparchus.geometry.partitioning.AbstractRegion
applyTransform, checkPoint, checkPoint, checkPoint, checkPoint, contains, copySelf, getBarycenter, getBoundarySize, getSize, getTolerance, getTree, intersection, isEmpty, isEmpty, isFull, isFull, projectToBoundary, setBarycenter, setBarycenter, setSize




Constructor Detail

PolyhedronsSet
public PolyhedronsSet(double tolerance)
Build a polyhedrons set representing the whole real line. Parameters:
tolerance
 tolerance below which points are considered identical

PolyhedronsSet
public PolyhedronsSet(BSPTree<Euclidean3D> tree, double tolerance)
Build a polyhedrons set from a BSP tree.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 constantsBoolean.TRUE
andBoolean.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
orClassCastException
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. Parameters:
tree
 inside/outside BSP tree representing the regiontolerance
 tolerance below which points are considered identical

PolyhedronsSet
public PolyhedronsSet(Collection<SubHyperplane<Euclidean3D>> boundary, double tolerance)
Build a polyhedrons set from a Boundary REPresentation (Brep) specified by subhyperplanes.The boundary is provided as a collection of
subhyperplanes
. Each subhyperplane 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 nonconnected 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.
 Parameters:
boundary
 collection of boundary elements, as a collection ofSubHyperplane
objectstolerance
 tolerance below which points are considered identical

PolyhedronsSet
public PolyhedronsSet(List<Vector3D> vertices, List<int[]> facets, double tolerance)
Build a polyhedrons set from a Boundary REPresentation (Brep) specified by connected vertices.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.
 Parameters:
vertices
 list of polyhedrons set verticesfacets
 list of facets, as vertices indices in the vertices listtolerance
 tolerance below which points are considered identical Throws:
MathIllegalArgumentException
 if some basic sanity checks fail

PolyhedronsSet
public PolyhedronsSet(PolyhedronsSet.BRep brep, double tolerance)
Build a polyhedrons set from a Boundary REPresentation (Brep) specified by connected vertices.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.
 Parameters:
brep
 Boundary REPresentation of the polyhedron to buildtolerance
 tolerance below which points are considered identical Throws:
MathIllegalArgumentException
 if some basic sanity checks fail Since:
 1.2

PolyhedronsSet
public PolyhedronsSet(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax, double tolerance)
Build a parallellepipedic box. Parameters:
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


Method Detail

buildNew
public PolyhedronsSet buildNew(BSPTree<Euclidean3D> tree)
Build a region using the instance as a prototype.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 constantsBoolean.TRUE
andBoolean.FALSE
. The tree also must have either null internal nodes or internal nodes representing the boundary as specified in thegetTree
method). Specified by:
buildNew
in interfaceRegion<Euclidean3D>
 Specified by:
buildNew
in classAbstractRegion<Euclidean3D,Euclidean2D>
 Parameters:
tree
 inside/outside BSP tree representing the new region Returns:
 the built region

getBRep
public PolyhedronsSet.BRep getBRep() throws MathRuntimeException
Get the boundary representation of the instance.The boundary representation can be extracted only from bounded polyhedrons sets. If the polyhedrons set is unbounded, a
MathRuntimeException
will be thrown.The boundary representation extracted is not minimal, as for example canonical facets may be split into several smaller independent subfacets sharing the same plane and connected by their edges.
As the
BRep
representation does not support facets with several boundary loops (for example facets with holes), an exception is triggered when attempting to extract BRep from such complex polyhedrons sets. Returns:
 boundary representation of the instance
 Throws:
MathRuntimeException
 if polyhedrons is unbounded Since:
 1.2

computeGeometricalProperties
protected void computeGeometricalProperties()
Compute some geometrical properties.The properties to compute are the barycenter and the size.
 Specified by:
computeGeometricalProperties
in classAbstractRegion<Euclidean3D,Euclidean2D>

firstIntersection
public SubHyperplane<Euclidean3D> firstIntersection(Vector3D point, Line line)
Get the first subhyperplane crossed by a semiinfinite line. Parameters:
point
 start point of the part of the line consideredline
 line to consider (contains point) Returns:
 the first subhyperplane crossed by the line after the given point, or null if the line does not intersect any subhyperplane

rotate
public PolyhedronsSet rotate(Vector3D center, Rotation rotation)
Rotate the region around the specified point.The instance is not modified, a new instance is created.
 Parameters:
center
 rotation centerrotation
 vectorial rotation operator Returns:
 a new instance representing the rotated region

translate
public PolyhedronsSet translate(Vector3D translation)
Translate the region by the specified amount.The instance is not modified, a new instance is created.
 Parameters:
translation
 translation to apply Returns:
 a new instance representing the translated region

