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>>
-
-
Constructor Summary
Constructors Constructor Description BoundaryProjector(P point)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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.P
getProjected()
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.BSPTreeVisitor.Result
visit(N node)
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
-
-
-
-
Constructor Detail
-
BoundaryProjector
public BoundaryProjector(P point)
Simple constructor.- Parameters:
point
- the point to project onto the region's boundary
-
-
Method Detail
-
visit
public BSPTreeVisitor.Result visit(N node)
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
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.- 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
protected 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.- 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
public P 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
-
-