Torus

class compas.geometry.Torus[source]

Bases: Shape

A torus is defined by a plane and two radii.

Parameters:
radius_axis: float, optional

The radius of the axis.

radius_pipe: float, optional

The radius of the pipe.

framecompas.geometry.Frame, optional

The local coordinate system of the torus. Default is None, in which case the torus is constructed in the world XY plane.

namestr, optional

The name of the shape.

Examples

>>> from compas.geometry import Frame
>>> from compas.geometry import Torus
>>> torus = Torus(frame=Frame.worldXY(), radius_axis=5.0, radius_pipe=2.0)
>>> torus = Torus(radius_axis=5.0, radius_pipe=2.0)
Attributes:
framecompas.geometry.Frame

The coordinate system of the torus.

transformationcompas.geometry.Transformation

The transformation of the sphere to global coordinates.

radius_axisfloat

The radius of the axis.

radius_pipefloat

The radius of the pipe.

axiscompas.geometry.Line, read-only

The central axis of the torus.

basecompas.geometry.Point, read-only

The base point of the torus. The base point is at the origin of the local coordinate system.

planecompas.geometry.Plane, read-only

The plane of the torus. 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.

circlecompas.geometry.Circle, read-only

The base circle of the torus. The center of the circle is at the origin of the local coordinate system.

areafloat, read-only

The surface area of the torus.

volumefloat, read-only

The volume of the torus.

Methods

from_plane_and_radii

Construct a torus from a plane and two radii.

to_brep

Returns a BRep representation of the torus.

to_vertices_and_faces

Returns a list of vertices and faces.

transform

Transform the torus.

Inherited Methods

ToString

Converts the instance to a string.

compute_aabb

Compute the axis-aligned bounding box of the geometry.

compute_obb

Compute the oriented bounding box of the geometry.

contains_point

Verify if a point is inside the shape.

contains_points

Verify if a list of points are inside the shape.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

rotate

Rotate the shape.

rotated

Returns a rotated copy of this geometry.

scale

Scale the shape.

scaled

Returns a scaled copy of this geometry.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

to_polyhedron

Convert the shape to a polyhedron.

transformed

Returns a transformed copy of this geometry.

translate

Translate the shape.

translated

Returns a translated copy of this geometry.

validate_data

Validate the data against the object's data schema.