Logo Search packages:      
Sourcecode: inkscape version File versions

SPItem* unclump_closest ( SPItem item,
GSList *  others 
)

Closest to item among others

Definition at line 189 of file unclump.cpp.

References unclump_dist().

Referenced by unclump().

{
    double min = HUGE_VAL;
    SPItem *closest = NULL;

    for (GSList *i = others; i != NULL; i = i->next) {
        SPItem *other = SP_ITEM (i->data);

        if (other == item)
            continue;

        double dist = unclump_dist (item, other);
        if (dist < min && fabs (dist) < 1e6) {
            min = dist;
            closest = other;
        }
    }

    return closest;
}


Generated by  Doxygen 1.6.0   Back to index