BoundingVolumeHierarchy

class BoundingVolumeHierarchy(*args)

Bounding Volume Hierarchy to speed-up point location.

This spatial data structure helps to find the simplex containing a given point.

Available constructors:

BoundingVolumeHierarchy(points, simplices)

BoundingVolumeHierarchy(points, simplices, binNumber)

BoundingVolumeHierarchy(points, simplices, binNumber, strategy)

Parameters
points2-d sequence of float

Points.

simplicesIndicesCollection

Simplices.

binNumberint

Maximum number of simplices stored in tree leaves. By default, it is equal to the value defined through the key BoundingVolumeHierarchy-BinNumber of the ResourceMap.

strategystr

Node splitting strategy. Valid values are: Mean and Median. By default, it is equal to the value defined through the key BoundingVolumeHierarchy-Strategy of the ResourceMap (Mean).

Examples

>>> import openturns as ot
>>> mesher = ot.IntervalMesher([5, 10])
>>> lowerbound = [0.0, 0.0]
>>> upperBound = [2.0, 4.0]
>>> interval = ot.Interval(lowerbound, upperBound)
>>> mesh = mesher.build(interval)
>>> locator = ot.BoundingVolumeHierarchy(mesh.getVertices(), mesh.getSimplices())
>>> simplex = locator.query([0.1, 0.2])

Methods

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getName(self)

Accessor to the object’s name.

getShadowedId(self)

Accessor to the object’s shadowed id.

getSimplices(self)

Collection of simplex accessor.

getVertices(self)

Collection of vertices accessor.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

query(self, \*args)

Get the index of the enclosing simplex of the given point.

setName(self, name)

Accessor to the object’s name.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVerticesAndSimplices(self, vertices, …)

Rebuild a new data structure for these vertices and simplices.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getSimplices(self)

Collection of simplex accessor.

Returns
simplicesIndicesCollection

Collection of simplices.

getVertices(self)

Collection of vertices accessor.

Returns
verticesSample

Collection of points.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

query(self, \*args)

Get the index of the enclosing simplex of the given point.

Available usages:

query(point)

query(sample)

Parameters
pointsequence of float

Given point.

sample2-d sequence of float

Given points.

Returns
indexint

If point is enclosed in a simplex, return its index; otherwise return an int which is at least greater than the number of simplices.

indicesopenturns.Indices

Index of enclosing simplex of each point of the sample. If there is no enclosing simplex, value is an int which is at least greater than the number of simplices.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVerticesAndSimplices(self, vertices, simplices)

Rebuild a new data structure for these vertices and simplices.

Parameters
verticesSample

Vertices.

simplicesIndicesCollection

Simplices.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.