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 value t=1.0 corresponds to the end angle of the arc. The value t=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.

framecompas.geometry.Frame, optional

Local coordinate system of the arc. Defaults to the world XY plane.

namestr, optional

The name of the arc.

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_view2.app import App   
>>> viewer = App()                     
>>> viewer.add(arc.to_polyline(n=20))  
>>> viewer.add(arc.frame)              
>>> viewer.run()                       

Visualize only part of the arc.

>>> from compas_view2.app import App                        
>>> viewer = App()                                          
>>> viewer.add(arc.to_polyline(n=20, domain=(0.25, 0.75)))  
>>> viewer.add(arc.frame)                                   
>>> viewer.run()                                            
Attributes:
framecompas.geometry.Frame

The coordinate frame of the arc.

transformationTransformation, 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.

circlecompas.geometry.Circle, read-only

The underlying circle.

planecompas.geometry.Plane, read-only

The plane of the arc.

diameterfloat, read-only

The diameter of the underlying circle.

lengthfloat, read-only

Compute 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.

Methods

from_circle

Creates an Arc from a circle and start and end angles.

normal_at

Construct a normal vector to the arc at a specific parameter.

point_at

Returns the point at the specified parameter.

tangent_at

Construct a tangent on the circle at a specific parameter.

Inherited Methods

ToString

Converts the instance to a string.

aabb

Compute the axis-aligned bounding box of the curve.

closest_point

Compute the closest point on the curve to a given point.

compute_aabb

Compute the axis-aligned bounding box of the geometry.

compute_obb

Compute the oriented bounding box of the geometry.

copy

Make an independent copy of the data object.

curvature_at

Compute the curvature vector of the curve at a parameter.

divide_by_count

Compute the curve parameters that divide the curve into a specific number of equal length segments.

divide_by_length

Compute the curve parameters that divide the curve into segments of specified length.

fair

frame_at

Compute the local frame of the curve at a parameter.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

from_obj

Load a curve from an OBJ file.

from_step

Load a curve from a STP file.

offset

reverse

Reverse the parametrisation of the curve.

reversed

Reverse a copy of the curve.

rotate

Rotate the geometry.

rotated

Returns a rotated copy of this geometry.

scale

Scale the geometry.

scaled

Returns a scaled copy of this geometry.

sha256

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

smooth

split

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_obj

Write the curve geometry to an OBJ file.

to_points

Convert the curve to a list of points.

to_polygon

Convert the curve to a polygon.

to_polyline

Convert the curve to a polyline.

to_step

Write the curve geometry to a STP file.

transform

Transform the local coordinate system of the curve.

transformed

Returns a transformed copy of this geometry.

translate

Translate the geometry.

translated

Returns a translated copy of this geometry.

trim

validate_data

Validate the data against the object's data schema.