Arc
- class compas.geometry.Arc[source]
Bases:
Curve
An arc is a segment of a circle, and is defined by a coordinate system, radius, and start and end angles.
The centre of the underlying circle is at the origin of the coordinate system. The start and end angles are measured from the positive X axis towards the positive Y axis.
The parametrisation of the arc is normalised with respect to the arc angle. The value
t=0.0
corresponds to the start angle of the arc. The valuet=1.0
corresponds to the end angle of the arc. The valuet=0.5
corresponds to the angle halfway between start and end.Transformations of the arc are performed by transforming the local coordinate system.
- Parameters:
- radiusfloat
Radius of the arc’s circle.
- start_anglefloat
The angle in radians of the start of this Arc.
- end_anglefloat
The angle in radians of the end of this Arc.
- frame
compas.geometry.Frame
, optional Local coordinate system of the arc. Defaults to the world XY plane.
- namestr, optional
The name of the arc.
- Attributes:
- frame
compas.geometry.Frame
The coordinate frame of the arc.
- transformation
Transformation
, read-only The transformation from the local coordinate system of the arc (
frame
) to the world coordinate system.- radiusfloat
The radius of the circle.
- start_anglefloat
The start angle of the arc.
- end_anglefloat
The end angle of the arc.
- circle
compas.geometry.Circle
, read-only The underlying circle.
- plane
compas.geometry.Plane
, read-only The plane of the arc.
- diameterfloat, read-only
The diameter of the underlying circle.
length
float, read-onlyCompute the length of the curve.
- anglefloat, read-only
The sweep angle in radians between start angle and end angle.
- circumferencefloat, read-only
The circumference of the underlying circle.
- is_closedbool, read-only
False.
- is_periodicbool, read-only
False.
- frame
See also
Examples
Construct a semicircular arc in the XY plane, with radius 1.0, and compute its length.
>>> from math import pi >>> from compas.geometry import Arc >>> arc = Arc(radius=1.0, start_angle=0.0, end_angle=pi) >>> arc.length == 1.0 * pi True
Construct a quarter arc in the 3rd quadrant of a frame aligned with the world ZX plane at a distance of 1.0 from the world origin along the world Y axis.
>>> from math import pi >>> from compas.geometry import Frame >>> from compas.geometry import Arc >>> frame = Frame([0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0]) >>> arc = Arc(radius=1.0, start_angle=pi, end_angle=pi * 1.5, frame=frame) >>> arc.length == 1.0 * pi * 0.5 True
Visualize the arc using the viewer.
>>> from compas_viewer import Viewer >>> viewer = Viewer() >>> viewer.scene.add(arc.to_polyline(n=20)) >>> viewer.scene.add(arc.frame) >>> viewer.show()
Visualize only part of the arc.
>>> from compas_viewer import Viewer >>> viewer = Viewer() >>> viewer.scene.add(arc.to_polyline(n=20, domain=(0.25, 0.75))) >>> viewer.scene.add(arc.frame) >>> viewer.show()
Methods
Creates an Arc from a circle and start and end angles.
Construct a normal vector to the arc at a specific parameter.
Returns the point at the specified 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 closest point on the curve to a given point.
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.
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.