Table of Contents

Method ToPolygonByChordTolerance

Namespace
GeometryHelper.Core
Assembly
GeometryHelper.dll

ToPolygonByChordTolerance(GeoEllipse2, double)

Approximates the rim of an ellipse as a polygon that strays no further from it than a chord tolerance.

public static GeoPolygon2 ToPolygonByChordTolerance(GeoEllipse2 ellipse, double chordTolerance)

Parameters

ellipse GeoEllipse2

The ellipse.

chordTolerance double

The largest gap allowed between an edge and the rim, in drawing units. Zero picks GeometryHelper.Internal.Tessellation.AutomaticChordRatio of the minor radius, which is the circle's share when the radii are equal.

Returns

GeoPolygon2

A polygon inscribed in the ellipse, counter-clockwise from the end of the major axis, its first point not repeated; symmetric about both axes, with a corner at each end of each.

Remarks

The corners are spaced by the bend of the rim, close where it turns sharply at the ends of the major axis and far apart along the flat sides: an ellipse 1 000 by 1 at the automatic tolerance of 0.002 takes 84 edges, where an even step in the angle would need about 1 571. A circle takes as many as ToPolygonByChordTolerance(double) gives, or up to three more to make a multiple of four; the same bend decides the count however fine the tolerance, up to 1 048 576 corners in all, and a tolerance that needs more is refused.

Exceptions

ArgumentOutOfRangeException

Thrown when the tolerance is negative or not a number, or needs more than 1 048 576 corners.