Class AbstractConvexHyperplaneBoundedRegion<P extends Point<P>, S extends HyperplaneConvexSubset<P>>
java.lang.Object
org.apache.commons.geometry.core.partitioning.AbstractConvexHyperplaneBoundedRegion<P,S>
- Type Parameters:
P- Point implementation typeS- Hyperplane convex subset implementation type
- All Implemented Interfaces:
HyperplaneBoundedRegion<P>, Splittable<P, HyperplaneBoundedRegion<P>>, Region<P>, Sized
- Direct Known Subclasses:
ConvexArea, ConvexArea2S, ConvexVolume
public abstract class AbstractConvexHyperplaneBoundedRegion<P extends Point<P>, S extends HyperplaneConvexSubset<P>>
extends Object
implements HyperplaneBoundedRegion<P>
Base class for convex hyperplane-bounded regions. This class provides generic implementations of many
algorithms related to convex regions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAbstractConvexHyperplaneBoundedRegion.ConvexRegionBoundaryBuilder<P extends Point<P>, S extends HyperplaneConvexSubset<P>>Internal class encapsulating the logic for building convex region boundaries from collections of hyperplanes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractConvexHyperplaneBoundedRegion(List<S> boundaries) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionClassify the given point with respect to the region.Get the boundaries of the convex region.doubleGet the size of the boundary of the region.booleanisEmpty()Return true if the region is completely empty, ie all points in the space are classified asoutside.booleanisFull()Return true if the region spans the entire space.Project a point onto the boundary of the region.protected <R extends AbstractConvexHyperplaneBoundedRegion<P,S>>
Split<R> splitInternal(Hyperplane<P> splitter, R thisInstance, Class<S> boundaryType, Function<List<S>, R> factory) Generic, internal split method.protected booleanswapsInsideOutside(Transform<P> transform) Return true if the given transform swaps the inside and outside of the region.toString()protected <R extends AbstractConvexHyperplaneBoundedRegion<P,S>>
RtransformInternal(Transform<P> transform, R thisInstance, Class<S> boundaryType, Function<? super List<S>, R> factory) Generic, internal transform method.trim(HyperplaneConvexSubset<P> sub) Trim the given hyperplane subset to the portion contained inside this instance.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Region
contains, getCentroidMethods inherited from interface Sized
getSize, isFinite, isInfiniteMethods inherited from interface Splittable
split
-
Constructor Details
-
AbstractConvexHyperplaneBoundedRegion
Simple constructor. Callers are responsible for ensuring that the given list of boundaries define a convex region. No validation is performed.- Parameters:
boundaries- the boundaries of the convex region
-
-
Method Details
-
getBoundaries
Get the boundaries of the convex region. The exact ordering of the boundaries is not guaranteed.- Returns:
- the boundaries of the convex region
-
isFull
-
isEmpty
-
getBoundarySize
Get the size of the boundary of the region. The size is a value in thed-1dimension space. For example, in Euclidean space, this will be a length in 2D and an area in 3D.- Specified by:
getBoundarySizein interfaceRegion<P extends Point<P>>- Returns:
- the size of the boundary of the region
-
classify
-
project
-
trim
Trim the given hyperplane subset to the portion contained inside this instance.- Parameters:
sub- hyperplane subset to trim. Null is returned if the subset does not intersect the instance.- Returns:
- portion of the argument that lies entirely inside the region represented by this instance, or null if it does not intersect.
-
toString
-
transformInternal
protected <R extends AbstractConvexHyperplaneBoundedRegion<P,S>> R transformInternal(Transform<P> transform, R thisInstance, Class<S> boundaryType, Function<? super List<S>, R> factory) Generic, internal transform method. Subclasses should use this to implement their own transform methods.- Type Parameters:
R- Region implementation type- Parameters:
transform- the transform to apply to the instancethisInstance- a reference to the current instance; this is passed as an argument in order to allow it to be a generic typeboundaryType- the type used for the boundary hyperplane subsetsfactory- function used to create new convex region instances- Returns:
- the result of the transform operation
-
swapsInsideOutside
Return true if the given transform swaps the inside and outside of the region.The default behavior of this method is to return true if the transform does not preserve spatial orientation (ie,
Transform.preservesOrientation()is false). Subclasses may need to override this method to implement the correct behavior for their space and dimension.- Parameters:
transform- transform to check- Returns:
- true if the given transform swaps the interior and exterior of the region
-
splitInternal
protected <R extends AbstractConvexHyperplaneBoundedRegion<P,S>> Split<R> splitInternal(Hyperplane<P> splitter, R thisInstance, Class<S> boundaryType, Function<List<S>, R> factory) Generic, internal split method. Subclasses should call this from theirSplittable.split(Hyperplane)methods.- Type Parameters:
R- Region implementation type- Parameters:
splitter- splitting hyperplanethisInstance- a reference to the current instance; this is passed as an argument in order to allow it to be a generic typeboundaryType- the type used for the boundary hyperplane subsetsfactory- function used to create new convex region instances- Returns:
- the result of the split operation
-