Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

SPCurve * SPCurve::append_continuous ( SPCurve const *  c1,
gdouble  tolerance 
)

Append c1 to this with possible fusing of close endpoints. If the end of this curve and the start of c1 are within tolerance distance, then the startpoint of c1 is moved to the end of this curve and the first subpath of c1 is appended to the last subpath of this curve. When one of the curves (this curve or the argument curve) is closed, the returned value is NULL; otherwise the returned value is this curve. When one of the curves is empty, this curves path becomes the non-empty path.

Definition at line 526 of file curve.cpp.

References append(), first_point(), is_closed(), is_empty(), and last_point().

Referenced by fit_and_split(), and spdc_pen_finish_segment().

{
    using Geom::X;
    using Geom::Y;

    g_return_val_if_fail(c1 != NULL, NULL);
    if ( this->is_closed() || c1->is_closed() ) {
        return NULL;
    }

    if (c1->is_empty()) {
        return this;
    }

    if (this->is_empty()) {
        _pathv = c1->_pathv;
        return this;
    }

    if ( (fabs((*this->last_point())[X] - (*c1->first_point())[X]) <= tolerance)
         && (fabs((*this->last_point())[Y] - (*c1->first_point())[Y]) <= tolerance) )
    {
    // c1's first subpath can be appended to this curve's last subpath
        Geom::PathVector::const_iterator path_it = c1->_pathv.begin();
        Geom::Path & lastpath = _pathv.back();

        Geom::Path newfirstpath(*path_it);
        newfirstpath.setInitial(lastpath.finalPoint());
        lastpath.append( newfirstpath );

        for (path_it++; path_it != c1->_pathv.end(); path_it++) {
            _pathv.push_back( (*path_it) );
        }

    } else {
        append(c1, true);
    }

    return this;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index