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

static unsigned copy_without_nans_or_adjacent_duplicates ( NR::Point const   src[],
unsigned  src_len,
NR::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 145 of file bezier-utils.cpp.

Referenced by sp_bezier_fit_cubic_r().

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


Generated by  Doxygen 1.6.0   Back to index