Arc2PolyBezier procedure
Approximates an elliptical arc by an array of Bezier segments consisting of curve and control points.
Declaration
procedure Arc2PolyBezier(X: Integer; Y: Integer; Width: Integer;
Height: Integer; Angle1: Integer;
Angle2: Integer; Rotation: Integer;
var Points: TBezierPointArray)Description
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. Start of the arc is given by the eccentric angle Angle1, and its length is given by Angle2. Both angles are expressed in 1/16th of a degree. A full circle, for example, is equal 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 a angle for a rotated ellipse - for a non-rotated ellipse this value would be 0, or 360*16.
The arc is approximated by one or more Bezier curves. If the angle length is greater than 45*16 (45 degrees), it breaks the arc into arcs of 45 degrees.
The points with indices 0, 3, 6, etc are Bezier curve points (points on the arc), the points with indices 1, 4, 7 are the right-sided control points, those with indices 2, 5, ... the left-sided controls points of the curve points at indices 0, 3, 6, ...
The points are arranged such that they can be immediately passed to the TCanvas.PolyBezier with parameter Continuous = True.
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
