Shape
- class compas.geometry.Shape[source]
Bases:
Geometry
Base class for geometric shapes.
Shapes are parametrically defined with repsect to a local coordinate system. The local coordinate system of a shape is defined by a frame. The default frame is the word coordinate system, i.e. the origin and the axes of the world XY plane.
Shapes are finite, closed objects, with a boundary that separates the interior from the exterior. They have a well-defined surface area and volume.
An explicit representation of a shape is obtained by discretising its boundary into a set of vertices and faces with a chosen resolution (
to_vertices_and_faces()
). The vertices and faces can be used to construct acompas.geometry.Polyhedron
object (to_polyhedron()
). A shape can also be converted to acompas.geometry.Brep
object (to_brep()
).Breps and polyhedrons support boolean operations.
- Parameters:
- frame
compas.geometry.Frame
, optional The local coordinate system of the shape. Default is
None
, in which case the world coordinate system is used.
- frame
- Attributes:
- areafloat, read-only
The surface area of the shape.
- frame
compas.geometry.Frame
The local coordinate system of the shape.
- transformation
compas.geometry.Transformation
, read-only The transformation of the shape to global coordinates.
- volumefloat, read-only
The volume of the shape.
Methods
Compute the edges of the discrete representation of the shape.
Compute the triangles of the discrete representation of the shape.
Verify if a point is inside the shape.
Verify if a list of points are inside the shape.
Rotate the shape.
Scale the shape.
Convert the shape to a Brep.
Returns a mesh representation of the box.
Convert the shape to a polyhedron.
Convert the shape to a list of vertices and faces.
Transform the shape.
Translate the shape.
Inherited Methods
Converts the instance to a string.
Compute the axis-aligned bounding box of the geometry.
Compute the oriented bounding box of the geometry.
Make an independent copy of the data object.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Returns a rotated copy of this geometry.
Returns a scaled copy of this geometry.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Returns a transformed copy of this geometry.
Returns a translated copy of this geometry.
Validate the data against the object's data schema.