Polyhedron.from_halfspaces
- classmethod Polyhedron.from_halfspaces(halfspaces, interior_point)[source]
Construct a polyhedron from its half-spaces and one interior point.
- Parameters:
- halfspacesarray-like
The coefficients of the hgalfspace equations in normal form.
- interior_pointarray-like
A point on the interior.
- Returns:
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)