Class RegionCutBoundary<P extends Point<P>>
- java.lang.Object
-
- org.apache.commons.geometry.core.partitioning.bsp.RegionCutBoundary<P>
-
- Type Parameters:
P
- Point implementation type
- All Implemented Interfaces:
Sized
public final class RegionCutBoundary<P extends Point<P>> extends java.lang.Object implements Sized
Class representing the portion of anAbstractRegionNode
's cut that lies on the boundary of the region. Portions of the node cut may be oriented so that the plus side of the cut points toward the outside of the region (getOutsideFacing()
) and other portions toward the inside of the region (getInsideFacing()
). The inside-facing and outside-facing portions of the region boundary are represented as lists of disjoint hyperplane convex subsets, all originating from the same hyperplane convex subset forming the node cut.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<HyperplaneConvexSubset<P>>
insideFacing
Portion of the cut oriented such that the plus side of the cut points to the inside of the region.private java.util.List<HyperplaneConvexSubset<P>>
outsideFacing
Portion of the cut oriented such that the plus side of the cut points to the outside of the region.
-
Constructor Summary
Constructors Constructor Description RegionCutBoundary(java.util.List<HyperplaneConvexSubset<P>> insideFacing, java.util.List<HyperplaneConvexSubset<P>> outsideFacing)
Construct a new instance from the inside-facing and outside-facing portions of a node cut.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
anyContains(P pt, java.util.List<? extends HyperplaneConvexSubset<P>> boundaries)
Return true if the point is contained in any of the given boundaries.P
closest(P pt)
Return the closest point to the argument in the inside and outside facing portions of the cut boundary.boolean
contains(P pt)
Return true if the given point is contained in the boundary, in either the inside facing portion or the outside facing portion.boolean
containsInsideFacing(P pt)
Return true if the given point is contained in the inside-facing portion of the region boundary.boolean
containsOutsideFacing(P pt)
Return true if the given point is contained in the outside-facing portion of the region boundary.java.util.List<HyperplaneConvexSubset<P>>
getInsideFacing()
Get the portion of the cut with its plus side facing the inside of the region.java.util.List<HyperplaneConvexSubset<P>>
getOutsideFacing()
Get the portion of the cut with its plus side facing the outside of the region.double
getSize()
Get the total size of the cut boundary, including inside and outside facing components.private double
getTotalSize(java.util.List<? extends HyperplaneConvexSubset<P>> boundaries)
Get the total size of all boundaries in the given list.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.geometry.core.Sized
isFinite, isInfinite
-
-
-
-
Field Detail
-
insideFacing
private final java.util.List<HyperplaneConvexSubset<P extends Point<P>>> insideFacing
Portion of the cut oriented such that the plus side of the cut points to the inside of the region.
-
outsideFacing
private final java.util.List<HyperplaneConvexSubset<P extends Point<P>>> outsideFacing
Portion of the cut oriented such that the plus side of the cut points to the outside of the region.
-
-
Constructor Detail
-
RegionCutBoundary
RegionCutBoundary(java.util.List<HyperplaneConvexSubset<P>> insideFacing, java.util.List<HyperplaneConvexSubset<P>> outsideFacing)
Construct a new instance from the inside-facing and outside-facing portions of a node cut. The given lists are expected to be disjoint regions originating from the same hyperplane convex subset. No validation is performed.- Parameters:
insideFacing
- the inside-facing portion of the node cutoutsideFacing
- the outside-facing portion of the node cut
-
-
Method Detail
-
getInsideFacing
public java.util.List<HyperplaneConvexSubset<P>> getInsideFacing()
Get the portion of the cut with its plus side facing the inside of the region.- Returns:
- the portion of the cut with its plus side facing the inside of the region
-
getOutsideFacing
public java.util.List<HyperplaneConvexSubset<P>> getOutsideFacing()
Get the portion of the cut with its plus side facing the outside of the region.- Returns:
- the portion of the cut with its plus side facing the outside of the region
-
getSize
public double getSize()
Get the total size of the cut boundary, including inside and outside facing components.
-
getTotalSize
private double getTotalSize(java.util.List<? extends HyperplaneConvexSubset<P>> boundaries)
Get the total size of all boundaries in the given list.- Parameters:
boundaries
- boundaries to compute the size for- Returns:
- the total size of all boundaries in the given list
-
closest
public P closest(P pt)
Return the closest point to the argument in the inside and outside facing portions of the cut boundary.- Parameters:
pt
- the reference point- Returns:
- the point in the cut boundary closest to the reference point
- See Also:
HyperplaneSubset.closest(Point)
-
contains
public boolean contains(P pt)
Return true if the given point is contained in the boundary, in either the inside facing portion or the outside facing portion.- Parameters:
pt
- point to test- Returns:
- true if the point is contained in the boundary
- See Also:
HyperplaneSubset.contains(Point)
-
containsInsideFacing
public boolean containsInsideFacing(P pt)
Return true if the given point is contained in the inside-facing portion of the region boundary.- Parameters:
pt
- point to test- Returns:
- true if the point is contained in the inside-facing portion of the region boundary
-
containsOutsideFacing
public boolean containsOutsideFacing(P pt)
Return true if the given point is contained in the outside-facing portion of the region boundary.- Parameters:
pt
- point to test- Returns:
- true if the point is contained in the outside-facing portion of the region boundary
-
anyContains
private boolean anyContains(P pt, java.util.List<? extends HyperplaneConvexSubset<P>> boundaries)
Return true if the point is contained in any of the given boundaries.- Parameters:
pt
- point to testboundaries
-- Returns:
- true if the point is contained in any of the given boundaries
-
-