Skip to content

Element BVH¤

compas_model.models.bvh ¤

Classes¤

ElementBVH ¤

ElementBVH(
    nodetype: type[BVHNode[Element]] = ElementAABBNode,
    max_depth: int | None = None,
    leafsize: int = 1,
)
Methods:¤
nearby_elements ¤
nearby_elements(element: Element, tolerance: float = 0.0) -> Iterator[Element]

Yield elements whose bounds are within an absolute distance of an element.

Parameters:

  • element (Element) –

    The element around which to search.

  • tolerance (float, default: 0.0 ) –

    The absolute search distance.

Yields:

  • Element –

    Broad-phase proximity candidates, excluding element itself.

Raises:

Notes

The query expands the element's axis-aligned bounding box by tolerance in every direction. The results are conservative: an element may be yielded even when its geometry is farther away.

nearest_neighbors ¤
nearest_neighbors(element: Element) -> list[Element]

Find the N nearest neighbors to a given point.

Parameters:

  • element (Element) –

    The base element.

Returns:

overlap_elements ¤
overlap_elements(
    other: ElementBVH, *, self_collision: bool = False
) -> Iterator[tuple[Element, Element]]

Yield element pairs from overlapping BVH leaves.

Parameters:

  • other (ElementBVH) –

    The other element hierarchy.

  • self_collision (bool, default: False ) –

    Enable comparison of the hierarchy with itself.

Yields:

Notes

Candidate bounding volumes overlap, but the element geometries may not. Result ordering is not part of the public contract.