Cylinder

class compas.geometry.Cylinder(circle, height, **kwargs)[source]

Bases: Shape

A cylinder is defined by a circle and a height.

Parameters
  • circle ([plane, radius] | compas.geometry.Circle) – The circle of the cylinder.

  • height (float) – The height of the cylinder.

Attributes
  • plane (compas.geometry.Plane) – The plane of the cylinder.

  • circle (compas.geometry.Circle) – The circle of the cylinder.

  • center (compas.geometry.Point) – The center of the cylinder.

  • radius (float) – The radius of the cylinder.

  • height (float) – The height of the cylinder.

  • normal (compas.geometry.Vector, read-only) – The normal of the cylinder.

  • diameter (float, read-only) – The diameter of the cylinder.

  • area (float, read-only) – The surface area of the cylinder.

  • volume (float, read-only) – The volume of the cylinder.

Examples

>>> from compas.geometry import Plane
>>> from compas.geometry import Cylinder
>>> plane = Plane([0, 0, 0], [0, 0, 1])
>>> circle = Circle(plane, 5)
>>> cylinder = Cylinder(circle, 7)

Methods

from_data

Construct a cylinder from its data representation.

to_vertices_and_faces

Returns a list of vertices and faces.

transform

Transform the cylinder.

Inherited Methods

copy

Make an independent copy of the data object.

from_json

Construct an object from serialized data contained in a JSON file.

from_jsonstring

Construct an object from serialized data contained in a JSON string.

to_data

Convert an object to its native data representation.

to_json

Serialize the data representation of an object to a JSON file.

to_jsonstring

Serialize the data representation of an object to a JSON string.

transformed

Returns a transformed copy of this geometry.

validate_data

Validate the object's data against its data schema.

validate_json

Validate the object's data against its json schema.