Arc2D
Class full path: NemAll_Python_Geometry.Arc2D
Representation class for 2D arc.
Arc2D could be a circular or elliptical arc. All angles are given as central angles. In case of an elliptical arc the ellipse angle and the central angle do not correspond. All start angle is normalized to the range [-PI..2PI]. The winding direction of the arc could either be in clockwise or in counterclockwise direction.
Examples:
Circle with radius of 1000 mm and center point in 0,0
>>> Arc2D(Point2D(), 1000)
Circular 180 deg arc without axis rotation
>>> Arc2D(Point2D(), 1000, 1000, 0.0, 0.0, 3.14)
Circular 180 deg arc with 90 deg axis rotation:
>>> Arc2D(Point2D(), 1000, 1000, 3.14/2, 0.0, 3.14)
The same arc could be created without axis rotation only by increasing the start and end angles
by the axis angle like this:
>>> Arc2D(Point2D(), 1000, 1000, 0.0, 3.14/2, 3.14 + 3.14/2)
Elliptical 180 deg arc with major radius (at 0 deg) of 1000mm and minor radius (at 90 deg) of 500mm
>>> Arc2D(Point2D(), 500, 1000, 0, 0, 3.14)
Attributes
AxisAngle: Angle
property
writable
Get the axis angle
Returns the the angle of the major axis
Center: Point2D
property
writable
Get center point
CenterRel: Point2D
property
writable
Get center point in relative coordinate system.
CounterClockwise: bool
property
writable
Returns winding direction counterclockwise true/false
DeltaAngle: Angle
property
Get difference between EndAngle and StartAngle
EndAngle: Angle
property
writable
Get end angle
EndPoint: Point2D
property
writable
Get the end point in world coordinate system.
EndRelPoint: Point2D
property
Get the end point in relative coordinate system
MajorRadius: float
property
writable
Get major radius
MinorRadius: float
property
writable
Get minor radius
RefPoint: Point2D
property
writable
Get reference point
StartAngle: Angle
property
writable
Get start angle
StartPoint: Point2D
property
writable
Get the start point in world coordinate system.
StartRelPoint: Point2D
property
Get the start point in relative coordinate system
Functions
Close()
Close arc
End angle will be adjusted to close arc.
EqualRef(arc)
Test for equal reference points
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arc
|
Arc2D
|
Arc which will be compared |
required |
Returns:
Type | Description |
---|---|
bool
|
result as bool |
GetAxisAngle()
Get the axis angle
Returns the the angle of the major axis
Returns:
Type | Description |
---|---|
Angle
|
axis angle. |
GetCenter()
Get center point
Returns:
Type | Description |
---|---|
Point2D
|
center point |
GetCenterRel()
Get center point in relative coordinate system.
Returns:
Type | Description |
---|---|
Point2D
|
center point |
GetDeltaAngle()
Get difference between EndAngle and StartAngle
Returns:
Type | Description |
---|---|
Angle
|
delta angle |
GetEndAngle()
Get end angle
Returns:
Type | Description |
---|---|
Angle
|
end angle |
GetEndPoint()
Get the end point in world coordinate system.
Returns:
Type | Description |
---|---|
Point2D
|
point. |
GetEndRelPoint()
Get the end point in relative coordinate system
Returns:
Type | Description |
---|---|
Point2D
|
constant point. |
GetEndTangent()
Get tangent vector at the end point of Arc
Returns:
Type | Description |
---|---|
Vector2D
|
Tangent vector (unit vector) |
GetMajorRadius()
Get major radius
Returns:
Type | Description |
---|---|
float
|
major radius |
GetMinorRadius()
Get minor radius
Returns:
Type | Description |
---|---|
float
|
minor radius |
GetPoint(angle)
Get point on Arc in world coordinate system
Calculates the point at central angle in parameter angle on the Arc
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle
|
Angle
|
central angle of the point |
required |
Returns:
Type | Description |
---|---|
Point2D
|
point on Arc |
GetRefPoint()
Get reference point
Returns:
Type | Description |
---|---|
Point2D
|
reference point |
GetStartAngle()
Get start angle
Returns:
Type | Description |
---|---|
Angle
|
start angle |
GetStartPoint()
Get the start point in world coordinate system.
Returns:
Type | Description |
---|---|
Point2D
|
point. |
GetStartRelPoint()
Get the start point in relative coordinate system
Returns:
Type | Description |
---|---|
Point2D
|
constant point. |
GetStartTangent()
Get tangent vector at the start point of Arc
Returns:
Type | Description |
---|---|
Vector2D
|
Tangent vector (unit vector) |
IsAngleOnArc(angle)
Checks if the given angle lies on the arc
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle
|
Angle
|
angle angle to test |
required |
Returns:
Type | Description |
---|---|
bool
|
Angle on arc true/false |
IsCircle()
Test if ellipse is circle
Tests if major radius equals minor radius
Returns:
Type | Description |
---|---|
bool
|
if ellipse is circle |
IsClosed()
Check if arc is closed ( Full circle/ellipse )
Returns:
Type | Description |
---|---|
bool
|
closed curve true/false |
IsCounterClockwise()
Returns winding direction counterclockwise true/false
Returns:
Type | Description |
---|---|
bool
|
Is counterclockwise true/false |
Reverse()
Reverse of current arc
Method reverse Arc, start with end angle and orientation.
SetAxisAngle(angle)
Set the axis angle
Set the angle of the major axis
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle
|
Angle
|
axis angle |
required |
SetCenter(center)
Set center point
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center
|
Point2D
|
center point |
required |
SetCenterRel(center)
Set center point in local coordinate system
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center
|
Point2D
|
center point |
required |
SetCounterClockwise(ccw)
Set the winding direction of the arc
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ccw
|
bool
|
winding counterclockwise true/false |
required |
SetEndAngle(angle)
Set end angle
Set the end angle
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle
|
Angle
|
end angle |
required |
SetEndPoint(endpoint)
Set the end point in world coordinate system
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
Point2D
|
constant 2D point |
required |
SetMajorRadius(radius)
Set major radius
Parameters:
Name | Type | Description | Default |
---|---|---|---|
radius
|
float
|
major radius |
required |
SetMinorRadius(radius)
Set minor radius
Parameters:
Name | Type | Description | Default |
---|---|---|---|
radius
|
float
|
minor radius |
required |
SetRefPoint(refPoint)
Set reference point
Parameters:
Name | Type | Description | Default |
---|---|---|---|
refPoint
|
Point2D
|
reference point |
required |
SetStartAngle(angle)
Set start angle
Set the start angle
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angle
|
Angle
|
start angle |
required |
SetStartPoint(startpoint)
Set the start point in world coordinate system
Parameters:
Name | Type | Description | Default |
---|---|---|---|
startpoint
|
Point2D
|
constant 2D point |
required |
Supplement()
Convert to supplementary arc
Orientation of arc will not be changed.
__eq__(arc)
Comparison of arcs without tolerance.
Be careful, this method work without tolerance!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arc
|
Arc2D
|
Compared arc. |
required |
Returns:
Type | Description |
---|---|
object
|
True when arcs are equal, otherwise false. |
__init__
overload
__init__()
initialize
__init__(arc)
Copy constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arc
|
Arc2D
|
Arc2D to be copied |
required |
__init__(center, minor, major, axisangle, startangle, endangle, counterClockwise=True)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center
|
Point2D
|
Center point |
required |
minor
|
float
|
Minor radius |
required |
major
|
float
|
Major radius |
required |
axisangle
|
float
|
Axis angle |
required |
startangle
|
float
|
Start angle |
required |
endangle
|
float
|
End angle |
required |
counterClockwise
|
bool
|
Direction is counter clockwise: true/false |
True
|
__init__(center, radius, counterClockwise=True)
Constructor for creating circle
Create circle as arc with start angle 0 [rad] and end angle 2pi [rad]. Minor and major radii are equal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center
|
Point2D
|
Center point |
required |
radius
|
float
|
Minor radius |
required |
counterClockwise
|
bool
|
Direction is counter clockwise: true/false |
True
|
__mul__(matrix)
Matrix transformation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix
|
Matrix2D
|
transformation matrix. |
required |
Returns:
Type | Description |
---|---|
Arc2D
|
transformed Arc2D. |
__repr__()
Convert to string