Logo Search packages:      
Sourcecode: inkscape version File versions

int Geom::bezier_fit_cubic_r ( Point  bezier[],
Point const   data[],
int const   len,
double const   error,
unsigned const   max_beziers 
)

Fit a multi-segment Bezier curve to a set of digitized points, with possible weedout of identical points and NaNs.

Parameters:
max_beziers Maximum number of generated segments
Result array, must be large enough for n. segments * 4 elements.
Returns:
Number of segments generated, or -1 on error.

Definition at line 131 of file bezier-utils.cpp.

References bezier_fit_cubic_full(), and copy_without_nans_or_adjacent_duplicates().

Referenced by bezier_fit_cubic().

{
    if(bezier == NULL || 
       data == NULL || 
       len <= 0 || 
       max_beziers >= (1ul << (31 - 2 - 1 - 3))) 
        return -1;
    
    Point *uniqued_data = new Point[len];
    unsigned uniqued_len = copy_without_nans_or_adjacent_duplicates(data, len, uniqued_data);

    if ( uniqued_len < 2 ) {
        delete[] uniqued_data;
        return 0;
    }

    /* Call fit-cubic function with recursion. */
    int const ret = bezier_fit_cubic_full(bezier, NULL, uniqued_data, uniqued_len,
                                          unconstrained_tangent, unconstrained_tangent,
                                          error, max_beziers);
    delete[] uniqued_data;
    return ret;
}


Generated by  Doxygen 1.6.0   Back to index