Class AbstractRegionBSPTree.BoundaryProjector<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>
java.lang.Object
org.apache.commons.geometry.core.partitioning.bsp.BSPTreeVisitor.TargetPointVisitor<P,N>
org.apache.commons.geometry.core.partitioning.bsp.BSPTreeVisitor.ClosestFirstVisitor<P,N>
org.apache.commons.geometry.core.partitioning.bsp.AbstractRegionBSPTree.BoundaryProjector<P,N>
- Type Parameters:
P
- Point implementation typeN
- BSP tree node implementation type
- All Implemented Interfaces:
BSPTreeVisitor<P,
N>
- Direct Known Subclasses:
RegionBSPTree1D.BoundaryProjector1D
,RegionBSPTree1S.BoundaryProjector1S
,RegionBSPTree2D.BoundaryProjector2D
,RegionBSPTree2S.BoundaryProjector2S
,RegionBSPTree3D.BoundaryProjector3D
- Enclosing class:
AbstractRegionBSPTree<P extends Point<P>,
N extends AbstractRegionBSPTree.AbstractRegionNode<P, N>>
protected static class AbstractRegionBSPTree.BoundaryProjector<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>
extends BSPTreeVisitor.ClosestFirstVisitor<P,N>
Class used to compute the point on the region's boundary that is closest to a target point.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.geometry.core.partitioning.bsp.BSPTreeVisitor
BSPTreeVisitor.ClosestFirstVisitor<P extends Point<P>,
N extends BSPTree.Node<P, N>>, BSPTreeVisitor.FarthestFirstVisitor<P extends Point<P>, N extends BSPTree.Node<P, N>>, BSPTreeVisitor.Order, BSPTreeVisitor.Result, BSPTreeVisitor.TargetPointVisitor<P extends Point<P>, N extends BSPTree.Node<P, N>> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected P
disambiguateClosestPoint
(P target, P a, P b) Method used to determine which of pointsa
andb
should be considered as the "closest" point totarget
when the points are exactly equidistant.Get the projected point on the region's boundary, or null if no point could be found.protected boolean
isPossibleClosestCut
(HyperplaneSubset<P> cut, P target, double currentMinDist) Return true if the given node cut is a possible candidate for containing the closest region boundary point to the target.Visit a node in a BSP tree.Methods inherited from class org.apache.commons.geometry.core.partitioning.bsp.BSPTreeVisitor.ClosestFirstVisitor
visitOrder
Methods inherited from class org.apache.commons.geometry.core.partitioning.bsp.BSPTreeVisitor.TargetPointVisitor
getTarget
-
Field Details
-
projected
The projected point. -
minDist
private double minDistThe current closest distance to the boundary found.
-
-
Constructor Details
-
BoundaryProjector
Simple constructor.- Parameters:
point
- the point to project onto the region's boundary
-
-
Method Details
-
visit
Visit a node in a BSP tree. This method is called for both internal nodes and leaf nodes.- Parameters:
node
- the node being visited- Returns:
- the result of the visit operation
-
isPossibleClosestCut
Return true if the given node cut is a possible candidate for containing the closest region boundary point to the target.- Parameters:
cut
- the node cut to testtarget
- the target point being projectedcurrentMinDist
- the smallest distance found so far to a region boundary; this value is guaranteed to be non-negative- Returns:
- true if the cut is a possible candidate for containing the closest region boundary point to the target
-
disambiguateClosestPoint
Method used to determine which of pointsa
andb
should be considered as the "closest" point totarget
when the points are exactly equidistant.- Parameters:
target
- the target pointa
- first point to considerb
- second point to consider- Returns:
- which of
a
orb
should be considered as the one closest totarget
-
getProjected
Get the projected point on the region's boundary, or null if no point could be found.- Returns:
- the projected point on the region's boundary
-