Circle
- class compas.geometry.Circle[source]
Bases:
Conic
A circle is a curve defined by a coordinate system and a radius.
The centre of the circle is at the origin of the coordinate system. The z-axis of the coordinate system defines the normal of the circle plane. The parameter domain is normalized with respect to the polar angle. A parameter value of
t = 0
corresponds to the point on the circle at angle0
. A parameter value oft = 1
corresponds to the point on the circle at angle2 * pi
. Moving along the circle in the parameter direction corresponds to moving counter-clockwise around the origin of the local coordinate system.- Parameters:
- radiusfloat
The radius of the circle.
- frame
compas.geometry.Frame
, optional The coordinate frame of the circle. The default value is
None
, in which case the world coordinate system is used.- namestr, optional
The name of the circle.
- Attributes:
- frame
compas.geometry.Frame
The coordinate frame of the circle.
- transformation
Transformation
, read-only The transformation from the local coordinate system of the circle (
frame
) to the world coordinate system.- center
compas.geometry.Point
The center of the circle.
- radiusfloat
The radius of the circle.
- diameterfloat, read-only
The diameter of the circle.
- areafloat, read-only
The area of the circle.
- circumferencefloat, read-only
The circumference of the circle.
- eccentricityfloat, read-only
The eccentricity of the circle is zero.
- is_closedbool, read-only
True.
- is_periodicbool, read-only
True.
- frame
See also
Examples
Construct a circle in the world XY plane.
>>> from compas.geometry import Frame, Circle >>> circle = Circle(radius=5, frame=Frame.worldXY()) >>> circle = Circle(radius=5)
Construct a circle such that the Z axis of its frame such that it aligns with a given line.
>>> from compas.geometry import Line, Frame, Plane, Circle >>> line = Line([0, 0, 0], [1, 1, 1]) >>> plane = Plane(line.end, line.direction) >>> circle = Circle.from_plane_and_radius(plane, 5) >>> circle = Circle(radius=5, frame=Frame.from_plane(plane))
Visualise the line, circle, and frame of the circle with the COMPAS viewer.
>>> from compas_viewer import Viewer >>> viewer = Viewer() >>> viewer.scene.add(line) >>> viewer.scene.add(circle) >>> viewer.scene.add(circle.frame) >>> viewer.show()
Methods
Compute the closest point on the circle to a given point.
Verify that the circle contains a given point.
Construct a circle from a plane and a radius.
Construct a circle from a point and a radius.
Construct a circle from a list of at least three points.
Construct a circle from three points.
Construct a normal on the circle at a specific parameter.
Construct a point on the circle at a specific parameter.
Construct a tangent on the circle at a specific parameter.
Inherited Methods
Converts the instance to a string.
Compute the axis-aligned bounding box of the curve.
Compute the axis-aligned bounding box of the geometry.
Compute the oriented bounding box of the geometry.
Make an independent copy of the data object.
Compute the curvature vector of the curve at a parameter.
Compute the curve parameters that divide the curve into a specific number of equal length segments.
Compute the curve parameters that divide the curve into segments of specified length.
Compute the local frame of the curve at a parameter.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Construct a parametric curve from a native curve geometry.
Load a curve from an OBJ file.
Load a curve from a STP file.
Compute the length of the curve.
Reverse the parametrisation of the curve.
Reverse a copy of the curve.
Rotate the geometry.
Returns a rotated copy of this geometry.
Scale the 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.
Write the curve geometry to an OBJ file.
Convert the curve to a list of points.
Convert the curve to a polygon.
Convert the curve to a polyline.
Write the curve geometry to a STP file.
Transform the local coordinate system of the curve.
Returns a transformed copy of this geometry.
Translate the geometry.
Returns a translated copy of this geometry.
Validate the data against the object's data schema.