Class AbstractRegionBSPTree.BoundaryProjector<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>

Type Parameters:
P - Point implementation type
N - 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.
  • Field Details

    • projected

      private P extends Point<P> projected
      The projected point.
    • minDist

      private double minDist
      The current closest distance to the boundary found.
  • Constructor Details

    • BoundaryProjector

      public BoundaryProjector(P point)
      Simple constructor.
      Parameters:
      point - the point to project onto the region's boundary
  • Method Details

    • 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 test
      target - the target point being projected
      currentMinDist - 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 points a and b should be considered as the "closest" point to target when the points are exactly equidistant.
      Parameters:
      target - the target point
      a - first point to consider
      b - second point to consider
      Returns:
      which of a or b should be considered as the one closest to target
    • 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