Package org.apache.commons.geometry.core
Interface Region<P extends Point<P>>
- Type Parameters:
P
- Point implementation type
- All Superinterfaces:
Sized
- All Known Subinterfaces:
HyperplaneBoundedRegion<P>
- All Known Implementing Classes:
AbstractConvexHyperplaneBoundedRegion
,AbstractNSphere
,AbstractRegionBSPTree
,AngularInterval
,AngularInterval.Convex
,Circle
,ConvexArea
,ConvexArea2S
,ConvexVolume
,Interval
,Parallelepiped
,Parallelogram
,RegionBSPTree1D
,RegionBSPTree1S
,RegionBSPTree2D
,RegionBSPTree2S
,RegionBSPTree3D
,Sphere
Interface representing a region in a space. A region partitions a space
into sets of points lying on the inside, outside, and boundary.
-
Method Summary
Modifier and TypeMethodDescriptionClassify the given point with respect to the region.default boolean
Return true if the given point is on the inside or boundary of the region.double
Get the size of the boundary of the region.Get the centroid, or geometric center, of the region or null if no centroid exists or one exists but is not unique.boolean
isEmpty()
Return true if the region is completely empty, ie all points in the space are classified asoutside
.boolean
isFull()
Return true if the region spans the entire space.Project a point onto the boundary of the region.Methods inherited from interface org.apache.commons.geometry.core.Sized
getSize, isFinite, isInfinite
-
Method Details
-
isFull
boolean isFull()Return true if the region spans the entire space. In other words, a region is full if no points in the space are classified asoutside
.- Returns:
- true if the region spans the entire space
-
isEmpty
boolean isEmpty()Return true if the region is completely empty, ie all points in the space are classified asoutside
.- Returns:
- true if the region is empty
-
getBoundarySize
double getBoundarySize()Get the size of the boundary of the region. The size is a value in thed-1
dimension space. For example, in Euclidean space, this will be a length in 2D and an area in 3D.- Returns:
- the size of the boundary of the region
-
getCentroid
P getCentroid()Get the centroid, or geometric center, of the region or null if no centroid exists or one exists but is not unique. A centroid will not exist for empty or infinite regions.The centroid of a geometric object is defined as the mean position of all points in the object, including interior points, vertices, and other points lying on the boundary. If a physical object has a uniform density, then its center of mass is the same as its geometric centroid.
- Returns:
- the centroid of the region or null if no unique centroid exists
- See Also:
-
classify
Classify the given point with respect to the region.- Parameters:
pt
- the point to classify- Returns:
- the location of the point with respect to the region
-
contains
Return true if the given point is on the inside or boundary of the region.- Parameters:
pt
- the point to test- Returns:
- true if the point is on the inside or boundary of the region
-
project
Project a point onto the boundary of the region. Null is returned if the region contains no boundaries (ie, is eitherfull
orempty
).- Parameters:
pt
- pt to project- Returns:
- projection of the point on the boundary of the region or null if the region does not contain any boundaries
-