org.apache.commons.math3.geometry.partitioning

## Class RegionFactory.IntersectionMerger

- java.lang.Object
- - org.apache.commons.math3.geometry.partitioning.RegionFactory.IntersectionMerger

- All Implemented Interfaces:
    BSPTree.LeafMerger<S>
  Enclosing class:
    RegionFactory<S extends Space>

      private class RegionFactory.IntersectionMerger
      extends Object
      implements BSPTree.LeafMerger<S>

  BSP tree leaf merger computing union of two regions.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `RegionFactory.IntersectionMerger()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `BSPTree<S>` | `merge(BSPTree<S> leaf, BSPTree<S> tree, BSPTree<S> parentTree, boolean isPlusChild, boolean leafFromInstance)` Merge a leaf node and a tree node.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RegionFactory.IntersectionMerger

          private RegionFactory.IntersectionMerger()

  - ### Method Detail

    - #### merge

          public BSPTree<S> merge(BSPTree<S> leaf,
                         BSPTree<S> tree,
                         BSPTree<S> parentTree,
                         boolean isPlusChild,
                         boolean leafFromInstance)

      Merge a leaf node and a tree node.

      This method is called at the end of a recursive merging resulting from a `tree1.merge(tree2, leafMerger)` call, when one of the sub-trees involved is a leaf (i.e. when its cut-hyperplane is null). This is the only place where the precise semantics of the operation are required. For all upper level nodes in the tree, the merging operation is only a generic partitioning algorithm.

      Since the final operation may be non-commutative, it is important to know if the leaf node comes from the instance tree (`tree1`) or the argument tree (`tree2`). The third argument of the method is devoted to this. It can be ignored for commutative operations.

      The `BSPTree.insertInTree` method may be useful to implement this method.

      Specified by:
        `merge` in interface `BSPTree.LeafMerger<S extends Space>`
      Parameters:
        `leaf` - leaf node (its cut hyperplane is guaranteed to be null)
        `tree` - tree node (its cut hyperplane may be null or not)
        `parentTree` - parent tree to connect to (may be null)
        `isPlusChild` - if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null
        `leafFromInstance` - if true, the leaf node comes from the instance tree (`tree1`) and the tree node comes from the argument tree (`tree2`)
      Returns:
        the BSP tree resulting from the merging (may be one of the arguments)

Copyright (c) 2003-2013 Apache Software Foundation