Content


NTL
Core
BezierSubdivide

BezierSubdivide


Build list of points for cubic bezier spline so it can be used to draw smooth spline. First and second points of curve are not being added to point list by this function. They should be added before and after it call by caller if those points are needed. This allows to build continuous point list for several connected curves.

You can find more information in comments below.

void BezierSubdivide(
    const PointF &p1, // First point of curve 
    const PointF &c2, // First control point of curve 
    const PointF &c3, // Second control point of curve 
    const PointF &p4, // Second point of curve 
    std::vector<PointF> &points, // Points storage where new points will be added. It is not being cleared during this function call 
    const int curve_recursion_limit = 16, // Maximum subdivision depth 
    const float distance_tolerance = 0.5f, // Square of maximum allowed visual distance error(for example, if maximum allowed error is 0.5px, then this value should be 0.5 * 0.5 = 0.25) 
    const float angle_tolerance = DegToRad(1.0f), // Angle tolerance in radians 
    const float cusp_limit = DegToRad(1.0f), // Cusp tolerance in radians 
    const float curve_angle_tolerance = DegToRad(1.0f), // Curve angle tolerance in radians 
    const float curve_collinearity_tolerance = 1); // Collinearity tolerance
Namespace: nitisa
Include: Nitisa/Render/Utils.h