Top Description Fields Constructors Methods
org.apache.commons.math3.geometry.partitioning

pack-priv Class BoundaryProjector<S extends Space, T extends Space>

extends Object
implements BSPTreeVisitor<S extends Space>
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor
Type Parameters
<S>
Type of the space.
<T>
Type of the sub-space.
Imports
java.util.ArrayList, .List, org.apache.commons.math3.geometry.Point, .Space, org.apache.commons.math3.geometry.partitioning.Region.Location, org.apache.commons.math3.util.FastMath

Local tree visitor to compute projection on boundary.
Since
3.3

Field Summary

Modifier and TypeField and Description
private BSPTree<S>
leaf

Leaf node closest to the test point.

private double
offset

Current offset.

private final Point<S>
original

Original point.

private Point<S>
projected

Current best projected point.

Constructor Summary

AccessConstructor and Description
pack-priv
BoundaryProjector(final Point<S>
original point
original
)

Simple constructor.

Method Summary

Modifier and TypeMethod and Description
private void
addRegion(final SubHyperplane<S>
sub-hyperplane defining the region
sub
,
final List<Region<T>>
to fill up
list
)

Add a boundary region to a list.

private boolean

Returns:

true if point lies on the boundary part
belongsToPart
(final Point<S>
projected point to check
point
,
final Hyperplane<S>
hyperplane into which the point was projected
hyperplane
,
final Region<T>
boundary part
part
)

Check if a projected point lies on a boundary part.

private List<Region<T>>

Returns:

regions in the node sub-hyperplane
boundaryRegions
(final BSPTree<S>
internal node
node
)

Extract the regions of the boundary on an internal node.

public BoundaryProjection<S>

Returns:

projection
getProjection
()

Get the projection.

private Point<S>

Returns:

projection to a singular point of boundary part (may be null)
singularProjection
(final Point<S>
projected point to check
point
,
final Hyperplane<S>
hyperplane into which the point was projected
hyperplane
,
final Region<T>
boundary part
part
)

Get the projection to the closest boundary singular point.

public void
visitInternalNode(final BSPTree<S>
BSP node guaranteed to have a non null cut sub-hyperplane
node
)

Implements org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitInternalNode.

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

public void
visitLeafNode(final BSPTree<S>
leaf BSP node having a null sub-hyperplane
node
)

Implements org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitLeafNode.

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

public BSPTreeVisitor.Order
visitOrder(final BSPTree<S>
BSP node guaranteed to have a non null cut sub-hyperplane
node
)

Implements org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitOrder.

Determine the visit order for this node.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

leafback to summary
private BSPTree<S> leaf

Leaf node closest to the test point.

offsetback to summary
private double offset

Current offset.

originalback to summary
private final Point<S> original

Original point.

projectedback to summary
private Point<S> projected

Current best projected point.

Constructor Detail

BoundaryProjectorback to summary
pack-priv BoundaryProjector(final Point<S> original)

Simple constructor.

Parameters
original:Point<S>

original point

Method Detail

addRegionback to summary
private void addRegion(final SubHyperplane<S> sub, final List<Region<T>> list)

Add a boundary region to a list.

Parameters
sub:SubHyperplane<S>

sub-hyperplane defining the region

list:List<Region<T>>

to fill up

belongsToPartback to summary
private boolean belongsToPart(final Point<S> point, final Hyperplane<S> hyperplane, final Region<T> part)

Check if a projected point lies on a boundary part.

Parameters
point:Point<S>

projected point to check

hyperplane:Hyperplane<S>

hyperplane into which the point was projected

part:Region<T>

boundary part

Returns:boolean

true if point lies on the boundary part

boundaryRegionsback to summary
private List<Region<T>> boundaryRegions(final BSPTree<S> node)

Extract the regions of the boundary on an internal node.

Parameters
node:BSPTree<S>

internal node

Returns:List<Region<T>>

regions in the node sub-hyperplane

getProjectionback to summary
public BoundaryProjection<S> getProjection()

Get the projection.

Returns:BoundaryProjection<S>

projection

singularProjectionback to summary
private Point<S> singularProjection(final Point<S> point, final Hyperplane<S> hyperplane, final Region<T> part)

Get the projection to the closest boundary singular point.

Parameters
point:Point<S>

projected point to check

hyperplane:Hyperplane<S>

hyperplane into which the point was projected

part:Region<T>

boundary part

Returns:Point<S>

projection to a singular point of boundary part (may be null)

visitInternalNodeback to summary
public void visitInternalNode(final BSPTree<S> node)

Implements org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitInternalNode.

Doc from org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitInternalNode.

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:BSPTree<S>

BSP node guaranteed to have a non null cut sub-hyperplane

visitLeafNodeback to summary
public void visitLeafNode(final BSPTree<S> node)

Implements org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitLeafNode.

Doc from org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitLeafNode.

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

Parameters
node:BSPTree<S>

leaf BSP node having a null sub-hyperplane

visitOrderback to summary
public BSPTreeVisitor.Order visitOrder(final BSPTree<S> node)

Implements org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitOrder.

Doc from org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor.visitOrder.

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:BSPTree<S>

BSP node guaranteed to have a non null cut sub-hyperplane

Returns:BSPTreeVisitor.Order

desired visit order, must be one of Order#PLUS_MINUS_SUB, Order#PLUS_SUB_MINUS, Order#MINUS_PLUS_SUB, Order#MINUS_SUB_PLUS, Order#SUB_PLUS_MINUS, Order#SUB_MINUS_PLUS