C4 Engine
C4 Engine API Documentation

CubicBezier2D::CalculateQuadraticApproximation

Defined in:  TSBezier.h
Approximates a cubic Bézier curve with a set of quadratic Bézier curves.
Prototype

int32 CalculateQuadraticApproximation(float tolerance, QuadraticBezier2D *curveArray) const;

Parameters
tolerance The approximate maximum distance allowed between the input cubic curve and the output set of quadratic curves.
curveArray A pointer to an array where the quadratic Bézier curves are returned. This array must be large enough to hold 12 curves.
Description
The CalculateQuadraticApproximation function generates between one and twelve quadratic Bézier curves that approximate a single cubic Bézier curve within a given tolerance.

The return value is the number of quadratic curves that were generated, which is never greater that kMaxQuadraticCurveCount, defined to be 12. The maximum number of quadratic curves is generated only in extreme cases, and the typical number is around three or four.