[ 
https://issues.apache.org/jira/browse/GEOMETRY-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16800329#comment-16800329
 ] 

Matt Juntunen commented on GEOMETRY-32:
---------------------------------------

In the first quote, I'm using the term "input trees" to refer to the inputs to 
the boolean operation, not the inputs to the method. Hopefully some more 
examples will clarify.
{code:java}
// get references to two tree instances that should not be modified
RegionBSPTree<Vector3D> largeTree = getLargeReusableTree();
RegionBSPTree<Vector3D> giantTree = getGiantReusableTree();

// create a third tree to contain the result of our boolean operation
RegionBSPTree<Vector3D> resultTree = new RegionBSPTree<>();

// compute the intersection and store the result in resultTree; largeTree
// and giantTree are not modified.
resultTree.intersectionOf(largeTree, giantTree);
{code}
{code:java}
//  get a reference to an existing tree that should not be modified
RegionBSPTree<Vector3D> largeTree = getLargeReusableTree();

// do something to get another tree that we are free to modify
RegionBSPTree<Vector3D> tempTree = computeTemporaryTree();

// compute the intersection and store the result back in tempTree; 
// largeTree is not modified.
tempTree.intersection(largeTree);
{code}
So, I use the {{intersection(RegionBSPTree)}} and 
{{intersectionOf(RegionBSPTree, RegionBSPTree)}} methods above depending on 
whether or not I can modify one of the inputs. I think this is important 
because these trees could be quite large (I'm picturing hundreds of thousands 
of nodes for 3D models), so any opportunity we get to avoid copying one is 
worth taking.

> BSPTree Updates
> ---------------
>
>                 Key: GEOMETRY-32
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-32
>             Project: Apache Commons Geometry
>          Issue Type: Improvement
>          Components: core
>            Reporter: Matt Juntunen
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The following updates should be made to the BSPTree class:
> - add an {{isLeaf()}} method to replace all of the {{node.getCut() == null}} 
> expressions
> - add unit tests
> _Edit [2019-02-17]:_
> Additional goals:
> - Refactor the API to split the idea of a general BSPTree and a BSPTree used 
> for defining in/out regions. This could result in a BSPTree interface and a 
> RegionBSPTree interface. The goal here is to allow end-users to create their 
> own extensions of these classes and specialize them for their own 
> applications (for example, to implement spatial sorting or other algorithms). 
> This will be one of the only planned extension points in the library.
> - Make the API easier to use and extend and reduce the necessity of casting 
> (especially unchecked casting) as much as possible.
> - Add the idea of convex subhyperplanes to allow for more efficient tree 
> construction.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to