Logo Search packages:      
Sourcecode: inkscape version File versions

static unsigned Geom::copy_without_nans_or_adjacent_duplicates ( Point const   src[],
unsigned  src_len,
Point  dest[] 
) [static]

Copy points from src to dest, filter out points containing NaN and adjacent points with equal x and y.

Returns:
length of dest

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

Referenced by bezier_fit_cubic_r().

{
    unsigned si = 0;
    for (;;) {
        if ( si == src_len ) {
            return 0;
        }
        if (!is_nan(src[si][X]) &&
            !is_nan(src[si][Y])) {
            dest[0] = Point(src[si]);
            ++si;
            break;
        }
    }
    unsigned di = 0;
    for (; si < src_len; ++si) {
        Point const src_pt = Point(src[si]);
        if ( src_pt != dest[di]
             && !is_nan(src_pt[X])
             && !is_nan(src_pt[Y])) {
            dest[++di] = src_pt;
        }
    }
    unsigned dest_len = di + 1;
    assert( dest_len <= src_len );
    return dest_len;
}


Generated by  Doxygen 1.6.0   Back to index