snap.cpp revision f750db62ff32f0048fdc228874e70a1ad9af79ae
308N/A * \brief Various snapping methods 308N/A * Lauris Kaplinski <lauris@kaplinski.com> 308N/A * Frank Felfe <innerspace@iname.com> 308N/A * Carl Hetherington <inkscape@carlh.net> 308N/A * Copyright (C) 1999-2002 Authors 308N/A * Released under GNU GPL, read the file 'COPYING' for more information 1190N/A * \return true if one of the snappers will try to snap something. /* We have a list of points, which we are proposing to transform in some way. We need to see ** if any of these points, when transformed, snap to anything. If they do, we return the ** appropriate transformation with `true'; otherwise we return the original scale with `false'. /* Quick check to see if we have any snappers that are enabled */ /* The current best transformation */ /* The current best metric for the best transformation; lower is better, NR_HUGE ** means that we haven't snapped anything. /* Work out the transformed version of this point */ /* We snapped. Find the transformation that describes where the snapped point has ** ended up, and also the metric for this transformation. for (
int j = 0; j <
2; j++) {
/* Note it if it's the best so far */ t, p,
it,
false,
NR::
Point(),
SCALE,
NR::
Point(s[
NR::X], s[
NR::Y]), o,
NR::X,
false t, p,
it,
true, c,
SCALE,
NR::
Point(s[
NR::X], s[
NR::Y]), o,
NR::X,
false t, p,
it,
false,
NR::
Point(),
STRETCH,
NR::
Point(s, s), o, d, u
t, p,
it,
false,
NR::
Point(),
SKEW,
NR::
Point(s, s), o, d,
false c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :