summaryrefslogtreecommitdiffstats
path: root/src/snap.cpp
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2006-05-05 15:07:33 +0000
committercth103 <cth103@users.sourceforge.net>2006-05-05 15:07:33 +0000
commit899143e7e4c7447f089eb436e0f4250864ad276e (patch)
treeb985139268ff5ff8dccd1cad6ed85a701bc086e2 /src/snap.cpp
parentadded sections for lt, ko, zh_TW, resolution for patch #1399508 (copy README.*) (diff)
downloadinkscape-899143e7e4c7447f089eb436e0f4250864ad276e.tar.gz
inkscape-899143e7e4c7447f089eb436e0f4250864ad276e.zip
Remove some old snap code.
(bzr r738)
Diffstat (limited to 'src/snap.cpp')
-rw-r--r--src/snap.cpp51
1 files changed, 4 insertions, 47 deletions
diff --git a/src/snap.cpp b/src/snap.cpp
index 7c68ae877..bf5385910 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -165,11 +165,15 @@ std::pair<NR::Point, bool> SnapManager::_snapTransformed(Inkscape::Snapper::Poin
metric = NR::L2(result);
break;
case SCALE:
+ {
NR::Point const a = (snapped.getPoint() - origin);
NR::Point const b = (*i - origin);
result = NR::Point(a[NR::X] / b[NR::X], a[NR::Y] / b[NR::Y]);
metric = std::abs(NR::L2(result) - NR::L2(transformation));
break;
+ }
+ default:
+ g_assert_not_reached();
}
/* Note it if it's the best so far */
@@ -336,53 +340,6 @@ std::pair<double, bool> namedview_vector_snap_list(SPNamedView const *nv, Inksca
/**
- * Try to snap points in \a p after they have been scaled by \a sx with respect to
- * the origin \a norm. The best snap is the one that changes the scale least.
- *
- * \return Pair containing snapped scale and a flag which is true if a snap was made.
- */
-std::pair<double, bool> namedview_dim_snap_list_scale(SPNamedView const *nv, Inkscape::Snapper::PointType t,
- const std::vector<NR::Point> &p, NR::Point const &norm,
- double const sx, NR::Dim2 dim,
- std::list<const SPItem *> const &it)
-{
- SnapManager const &m = nv->snap_manager;
- if (m.willSnapSomething() == false) {
- return std::make_pair(sx, false);
- }
-
- g_assert(dim < 2);
-
- NR::Coord dist = NR_HUGE;
- double scale = sx;
-
- for (std::vector<NR::Point>::const_iterator i = p.begin(); i != p.end(); i++) {
- NR::Point q = *i;
- NR::Point check = q;
-
- /* Scaled version of the point we are looking at */
- check[dim] = (sx * (q - norm) + norm)[dim];
-
- if (fabs (q[dim] - norm[dim]) > MIN_DIST_NORM) {
- /* Snap this point */
- const NR::Coord d = namedview_dim_snap (nv, t, check, dim, it);
- /* Work out the resulting scale factor */
- double snapped_scale = (check[dim] - norm[dim]) / (q[dim] - norm[dim]);
-
- if (dist == NR_HUGE || fabs(snapped_scale - sx) < fabs(scale - sx)) {
- /* This is either the first point, or the snapped scale
- ** is the closest yet to the original.
- */
- scale = snapped_scale;
- dist = d;
- }
- }
- }
-
- return std::make_pair(scale, dist < NR_HUGE);
-}
-
-/**
* Try to snap points after they have been skewed.
*/
double namedview_dim_snap_list_skew(SPNamedView const *nv, Inkscape::Snapper::PointType t,