Torus

class compas.geometry.Torus(plane, radius_axis, radius_pipe)[source]

Bases: compas.geometry.shapes._shape.Shape

A torus is defined by a plane and two radii.

Parameters
  • plane (compas.geometry.Plane or tuple of point and normal) – The plane of the torus.

  • radius_axis (float) – The radius of the axis.

  • radius_pipe (float) – The radius of the pipe.

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

  • radius_axis (float) – The radius of the axis.

  • radius_pipe (float) – The radius of the pipe.

  • center (read-only) (compas.geometry.Point) – The center of the torus.

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

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

Examples

>>> from compas.geometry import Plane
>>> from compas.geometry import Torus
>>> torus = Torus(Plane.worldXY(), 5., 2.)

Methods

from_data(data)

Construct a torus from its data representation.

to_vertices_and_faces([u, v])

Returns a list of vertices and faces

transform(transformation)

Transform the torus.

Inherited Methods

copy()

Makes a copy of this primitive.

from_json(filepath)

Construct a primitive from structured data contained in a json file.

to_data()

Returns the data dictionary that represents the primitive.

to_json(filepath)

Serialise the structured data representing the primitive to json.

transformed(transformation)

Returns a transformed copy of this primitive.

validate_data()

Validate the data of this object against its data schema (self.DATASCHEMA).

validate_json()

Validate the data loaded from a JSON representation of the data of this object against its data schema (self.DATASCHEMA).