Logo Search packages:      
Sourcecode: inkscape version File versions

void Geom::length_integrating ( D2< SBasis > const &  B,
double &  result,
double &  abs_error,
double  tol 

Calculates the length of a D2<SBasis> through gsl integration.

B the Element.
tol the maximum error allowed.
result variable to be incremented with the length of the path
abs_error variable to be incremented with the estimated error
If you only want the length, this routine may be faster/more accurate.

Definition at line 455 of file sbasis-geometric.cpp.

Referenced by length().

    D2<SBasis> dB = derivative(B);
    SBasis dB2 = dot(dB, dB);
    gsl_function F;
    gsl_integration_workspace * w 
        = gsl_integration_workspace_alloc (20);
    F.function = &sb_length_integrating;
    F.params = (void*)&dB2;
    double quad_result, err;
    /* We could probably use the non adaptive code here if we removed any cusps first. */
    gsl_integration_qag (&F, 0, 1, 0, tol, 20, 
                         GSL_INTEG_GAUSS21, w, &quad_result, &err);
    abs_error += err;
    result += quad_result;

Generated by  Doxygen 1.6.0   Back to index