Class CircularArc
A class for creating circular arcs represented as a specified number of equidistant points
Inherited Members
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public static class CircularArc
Methods
| Edit this page View SourceCreateArcPoints(Vector2, float, float, float, int)
Creates the points forming a circular arc with a certain startAngle and length in degrees The function also enable to control the order the arcs are generated This is useful when the arc points are to be inserted in a bigger polygon, and be connected with more points where the order is important A positive arcLength means counterclockwise point generation (standard degrees increase counter-clockwise) A negative arcLenght mean clockwise point generation
Declaration
public static IEnumerable<Vector2> CreateArcPoints(Vector2 circleCenter, float radius, float startAngle, float arcLength, int numberOfPoints)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | circleCenter | The center point of the arc circle |
float | radius | The radius of the circular arc in points |
float | startAngle | The start angle |
float | arcLength | The arc length (positive or negative) |
int | numberOfPoints | The number of points interpolated on the arc. The startAngle and the computed endAngle will always have a point, and thus 'numberOfPoints' must not be less than 2 |
Returns
Type | Description |
---|---|
IEnumerable<Vector2> | A list of points for the generated arc |
Examples
Two equivalent circular arcs between 10 and 100 degrees (and thus 90 absolute degrees arcLength) can be generated in both opposite directions:
- startAngle = 10, arcLength = 90 (counterclockwise generation from 10 degrees to 100 degrees)
- startAngle = 100, arcLength = -90 (clockwise generation from 100 degrees to 10 degrees)
NormalizeDegreesToPositiveBelow360(float)
Normalizes degrees to a positive value in the range [0..360[.
Declaration
public static float NormalizeDegreesToPositiveBelow360(float degrees)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | The degrees to normalize |
Returns
Type | Description |
---|---|
float | A float. |