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
__init__
(plane, radius_axis, radius_pipe)Initialize self.
copy
()Makes a copy of this primitive.
from_data
(data)Construct a torus from its data representation.
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.
to_vertices_and_faces
([u, v])Returns a list of vertices and faces
transform
(transformation)Transform the torus.
transformed
(transformation)Returns a transformed copy of this primitive.
Validate the data of this object against its data schema (self.DATASCHEMA).
Validate the data loaded from a JSON representation of the data of this object against its data schema (self.DATASCHEMA).