mesh.Mesh.test_bounding_box#

Mesh.test_bounding_box(bb, dirs=(0, 1, 2), nodes='any', atol=0.0)#

Test which part of a Mesh is inside a given bounding box.

The test can be applied in 1, 2 or 3 viewing directions.

Parameters#

bb: Coords (2,3) or alike

The bounding box to test for.

dirs: tuple of ints (0,1,2)

The viewing directions in which to check the bounding_box bounds.

nodes:

Same as in test().

atol:

Same as in test().

Returns#

bool array

The array flags the elements that are inside the given bounding box.

Examples#

>>> M = Mesh(eltype='tri3').subdivide(2)
>>> M.coords
Coords([[0. ,  0. ,  0. ],
        [0.5,  0. ,  0. ],
        [1. ,  0. ,  0. ],
        [0. ,  0.5,  0. ],
        [0.5,  0.5,  0. ],
        [0. ,  1. ,  0. ]])
>>> M.elems
Elems([[0, 1, 3],
       [1, 2, 4],
       [3, 4, 5],
       [1, 4, 3]]..., eltype=Tri3)
>>> M.test_bounding_box([[-0.1,-0.1,0.0],[0.1,0.1,0.0]], nodes='any')
array([ True, False,  False,  False])
>>> M.test_bounding_box([[-0.1,-0.1,0.0],[0.1,0.1,0.0]], nodes='all')
array([False, False,  False,  False])
>>> M.test_bounding_box([[-0.1,-0.1,0.0],[0.1,0.1,0.0]], nodes='none')
array([False, True,  True,  True])