org.apache.commons.math3.geometry.partitioning

## Interface BSPTreeVisitor<S extends Space>

- Type Parameters:
    `S` - Type of the space.
  All Known Implementing Classes:
    AbstractRegion.BoundaryBuilder, BoundarySizeVisitor, OutlineExtractor.BoundaryProjector, PolygonsSet.SegmentsBuilder, PolyhedronsSet.FacetsContributionVisitor, RegionFactory.NodesCleaner

      public interface BSPTreeVisitor<S extends Space>

  This interface is used to visit `BSP tree` nodes.

  Navigation through `BSP trees` can be done using two different point of views:

  - the first one is in a node-oriented way using the `BSPTree.getPlus()`, `BSPTree.getMinus()` and `BSPTree.getParent()` methods. Terminal nodes without associated `sub-hyperplanes` can be visited this way, there is no constraint in the visit order, and it is possible to visit either all nodes or only a subset of the nodes
  - the second one is in a sub-hyperplane-oriented way using classes implementing this interface which obeys the visitor design pattern. The visit order is provided by the visitor as each node is first encountered. Each node is visited exactly once.
  Since:
    3.0
  Version:
    $Id: BSPTreeVisitor.java 1416643 2012-12-03 19:37:14Z tn $
  See Also:
    `BSPTree`, `SubHyperplane`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `BSPTreeVisitor.Order` Enumerate for visit order with respect to plus sub-tree, minus sub-tree and cut sub-hyperplane.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `visitInternalNode(BSPTree<S> node)` Visit a BSP tree node node having a non-null sub-hyperplane.
    `void` | `visitLeafNode(BSPTree<S> node)` Visit a leaf BSP tree node node having a null sub-hyperplane.
    `BSPTreeVisitor.Order` | `visitOrder(BSPTree<S> node)` Determine the visit order for this node.

- - ### Method Detail

    - #### visitOrder

          BSPTreeVisitor.Order visitOrder(BSPTree<S> node)

      Determine the visit order for this node.

      Before attempting to visit an internal node, this method is called to determine the desired ordering of the visit. It is guaranteed that this method will be called before `visitInternalNode` for a given node, it will be called exactly once for each internal node.

      Parameters:
        `node` - BSP node guaranteed to have a non null cut sub-hyperplane
      Returns:
        desired visit order, must be one of `BSPTreeVisitor.Order.PLUS_MINUS_SUB`, `BSPTreeVisitor.Order.PLUS_SUB_MINUS`, `BSPTreeVisitor.Order.MINUS_PLUS_SUB`, `BSPTreeVisitor.Order.MINUS_SUB_PLUS`, `BSPTreeVisitor.Order.SUB_PLUS_MINUS`, `BSPTreeVisitor.Order.SUB_MINUS_PLUS`

    - #### visitInternalNode

          void visitInternalNode(BSPTree<S> node)

      Visit a BSP tree node node having a non-null sub-hyperplane.

      It is guaranteed that this method will be called after `visitOrder` has been called for a given node, it wil be called exactly once for each internal node.

      Parameters:
        `node` - BSP node guaranteed to have a non null cut sub-hyperplane
      See Also:
        `visitLeafNode(org.apache.commons.math3.geometry.partitioning.BSPTree)`

    - #### visitLeafNode

          void visitLeafNode(BSPTree<S> node)

      Visit a leaf BSP tree node node having a null sub-hyperplane.
      Parameters:
        `node` - leaf BSP node having a null sub-hyperplane
      See Also:
        `visitInternalNode(org.apache.commons.math3.geometry.partitioning.BSPTree)`

Copyright (c) 2003-2013 Apache Software Foundation