Polyhedron

class compas.geometry.Polyhedron[source]

Bases: Geometry

A polyhedron is a geometric object defined by its vertices and faces.

Parameters:
verticeslist[[float, float, float] | compas.geometry.Point]

The point locations of the vertices of the polyhedron.

faceslist[list[int]]

The faces as a list of index lists.

namestr, optional

The name of the polyhedron.

Attributes:
verticeslist[list[float]]

The XYZ coordinates of the vertices of the polyhedron.

faceslist[list[int]]

The faces of the polyhedron defined as lists of vertex indices.

edgeslist[tuple[int, int]], read-only

The edges of the polyhedron as vertex index pairs.

Methods

boolean_difference

Compute the boolean difference of this polyhedron and another.

boolean_intersection

Compute the boolean intersection of this polyhedron and another.

boolean_union

Compute the boolean union of this polyhedron and another.

from_convex_hull

Construct a polyhedron from the convex hull of a set of points.

from_halfspaces

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

from_planes

Construct a polyhedron from intersecting planes.

from_platonicsolid

Construct a polyhedron from one of the platonic solids.

is_closed

Verify that the polyhedron forms a closed surface.

to_mesh

Returns a mesh representation of the polyhedron.

to_vertices_and_faces

Returns a list of vertices and faces.

transform

Transform the polyhedron.

Inherited Methods

ToString

Converts the instance to a string.

compute_aabb

Compute the axis-aligned bounding box of the geometry.

compute_obb

Compute the oriented bounding box of the geometry.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

rotate

Rotate the geometry.

rotated

Returns a rotated copy of this geometry.

scale

Scale the geometry.

scaled

Returns a scaled copy of this geometry.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

transformed

Returns a transformed copy of this geometry.

translate

Translate the geometry.

translated

Returns a translated copy of this geometry.

validate_data

Validate the data against the object's data schema.