Cylinder
- class compas.geometry.Cylinder[source]
Bases:
Shape
A cylinder is defined by a frame, radius, and height.
The cylinder is oriented along the z-axis of the frame. The base point of the cylinder (i.e. the centre of the base circle) is at the origin of the frame. Half of the cylinder is above the local XY plane of the frame, the other half below.
- Parameters:
- radiusfloat
The radius of the cylinder.
- heightfloat
The height of the cylinder along the z-axis of the frame. Half of the cylinder is above the XY plane of the frame, the other half below.
- frame
compas.geometry.Frame
, optional The local coordinate system, or “frame”, of the cylinder. Default is
None
, in which case the world coordinate system is used.- namestr, optional
The name of the shape.
Examples
>>> frame = Frame.worldXY() >>> cylinder = Cylinder(frame=frame, radius=0.3, heigth=1.0) >>> cylinder = Cylinder(radius=0.3, heigth=1.0) >>> cylinder = Cylinder()
- Attributes:
- areafloat, read-only
The surface area of the cylinder.
- axis
compas.geometry.Line
, read-only The central axis of the cylinder.
- base
compas.geometry.Point
, read-only The base point of the cylinder. The base point is at the origin of the local coordinate system.
- circle
compas.geometry.Circle
, read-only The base circle of the cylinder. The center of the circle is at the origin of the local coordinate system.
- diameterfloat, read-only
The diameter of the base circle of the cylinder.
- frame
compas.geometry.Frame
The local coordinate system of the cylinder. The cylinder is oriented along the local z-axis.
- heightfloat
The height of the cylinder.
- plane
compas.geometry.Plane
, read-only The plane of the cylinder. The base point of the plane is at the origin of the local coordinate system. The normal of the plane is in the direction of the z-axis of the local coordinate system.
- radiusfloat
The radius of the base circle of the cylinder.
- transformation
compas.geometry.Transformation
The transformation of the cylinder to global coordinates.
- volumefloat, read-only
The volume of the cylinder.
Methods
Verify if a point is inside the cylinder.
Construct a cylinder from a circle and a height.
Construct a cylinder from a line and a radius.
Scale the cylinder by multiplying the radius and height by a factor.
Returns a BRep representation of the cylinder.
Returns a list of vertices and faces.
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.
Verify if a list of points are inside the shape.
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.
Rotate the shape.
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.
Convert the shape to a polyhedron.
Transform the shape.
Returns a transformed copy of this geometry.
Translate the shape.
Returns a translated copy of this geometry.
Validate the data against the object's data schema.