Unit 'GraphMath' Package
[Overview][Types][Procedures and functions][Index] [#lazutils]

Arc2Bezier

Converts an Arc and ArcLength into a Bezier Approximation of the Arc.

Declaration

Source position: graphmath.pp line 49

procedure Arc2Bezier(

  X: LongInt;

  Y: LongInt;

  Width: LongInt;

  Height: LongInt;

  Angle1: Extended;

  Angle2: Extended;

  Rotation: Extended;

  var Points: TBezier

);

Arguments

X

  

Left coordinate for the upper/left corner of the rectangle where the arc is located.

Y

  

Top coordinate for the upper/left corner of the rectangle where the arc is located.

Width

  

Width for the rectangle where the arc is located.

Height

  

Height for the rectangle where the arc is located.

Angle1

  

Eccentric angle for the start of the arc.

Angle2

  

Eccentric angle which defines the length of the arc.

Rotation

  

Rotation angle for the arc specified in 1/16ths of a degree.

Points

  

TBezier instance where the array of floating point values for the bezier approximation is stored.

Description

Use Arc2Bezier to convert an elliptical arc into a Bezier approximation of the arc.

The arc is defined by a rectangle which bounds the full ellipse. The rectangle has the specified Width and Height, its top/left corner is at the point X, Y. The start of the arc is given by the eccentric Angle1, and its length is given by eccentric Angle2. Both angles are expressed in 1/16th of a degree, a full circle, for example, equals to 5760 (16*360). A positive value of Angle2 means counter-clockwise while a negative value means clockwise direction. Zero degrees is at the 3 o'clock position.

The Rotation parameter accepts an angle for a rotated ellipse - for a non-rotated ellipse this value would be 0, or 360*16.

If the angle length is greater than 90 degrees or is equal to 0, the procedure automatically exits, as Bezier cannot accurately approximate any angle greater then 90 degrees, and in fact for best results no angle greater than 45 should be converted, instead an array of Beziers should be created, each Bezier describing a portion of the total arc no greater than 45 degrees.


Version 4.4 Generated 2025-11-08 Home