mymesh.utils.MVBB#

mymesh.utils.MVBB(Points, return_matrix=False)[source]#

Calculate the minimum volume bounding box of the set of points. For a 2D set of points, the minimum area bounding rectangle is given.

Parameters:
  • Points (array_like) – (n,3) or (n,2) point coordinates.

  • return_matrix (bool, optional) – option to return the rotation matrix that aligns the input Points with the local coordinate system of the MVBB, by default False.

Returns:

  • mvbb (np.ndarray) – Coordinates of the corners of the MVBB

  • mat (np.ndarray, optional) – Rotation matrix that aligns the input Points with the local coordinate system of the MVBB

Examples

import mymesh
import numpy as np

# Load the stanford bunny
m = mymesh.demo_mesh('bunny')

# Perform an arbitrary rotation transformation to the mesh
m = m.Transform([np.pi/6, -np.pi/6, np.pi/6],
                transformation='rotation', InPlace=True)

mvbb = utils.MVBB(m.NodeCoords)
box = mymesh.primitives.Box(mvbb, Type='surf')
../../_images/mymesh-utils-MVBB-2.png