Sign in Join
FPDoc Onlineexperiment

EllipsePolygon function

In unit GraphMath

Gets an array of points for a polygon which approximates an ellipse in the specified rectangle.

Declaration

pascal
function EllipsePolygon(const aRect: TRect): TPointArray

Description

EllipsePolygon is a TPointArray function used to calculate the array of points which approximate an ellipse bounded by the rectangle specified in the ARect argument. In EllipsePolygon, the ellipse is aligned to X and Y axes in the rectangle. It calculates the center point, radii, and diameter for the ellipse using ARect as well as the minimum number of points needed such that the distance between the edges of the rectangle and the mathematical circle is less than the rounding error (0.5) and a smoother stepping value of 0.4. The points for the polygon are calculated and stored in the return value.

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.