Polyhedron.from_halfspaces

classmethod Polyhedron.from_halfspaces(halfspaces, interior_point)

Construct a polyhedron from its half-spaces and one interior point.

Parameters
  • halfspaces (array-like) – The coefficients of the hgalfspace equations in normal form.

  • interior_point (array-like) – A point on the interior.

Returns

compas.geometry.Polyhedron

Examples

>>> from compas.geometry import Plane
>>> left = Plane([-1, 0, 0], [-1, 0, 0])
>>> right = Plane([+1, 0, 0], [+1, 0, 0])
>>> top = Plane([0, 0, +1], [0, 0, +1])
>>> bottom = Plane([0, 0, -1], [0, 0, -1])
>>> front = Plane([0, -1, 0], [0, -1, 0])
>>> back = Plane([0, +1, 0], [0, +1, 0])
>>> import numpy as np
>>> halfspaces = np.array([left.abcd, right.abcd, top.abcd, bottom.abcd, front.abcd, back.abcd], dtype=float)
>>> interior = np.array([0, 0, 0], dtype=float)
>>> p = Polyhedron.from_halfspaces(halfspaces, interior)