Logo Search packages:      
Sourcecode: inkscape version File versions

NR::Coord namedview_vector_snap ( SPNamedView const *  nv,
Snapper::PointType  t,
NR::Point &  req,
NR::Point const &  d 

Look for snap point along the line described by the point req and the direction vector d. Modifies req to the snap point, if one is found.

The distance from req to the snap point along the vector d, or NR_HUGE if no snap point was found.
d ≠ (0, 0).

Definition at line 98 of file snap.cpp.

Referenced by namedview_dim_snap().

    g_assert(nv != NULL);

    std::list<const Snapper*> snappers = namedview_get_snappers(nv);

    NR::Coord best = NR_HUGE;
    for (std::list<const Snapper*>::const_iterator i = snappers.begin(); i != snappers.end(); i++) {
        NR::Point trial_req = req;
        NR::Coord dist = (*i)->vector_snap(t, trial_req, d);

        if (dist < best) {
            req = trial_req;
            best = dist;

    return best;

Generated by  Doxygen 1.6.0   Back to index