summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 52bc084)
raw | patch | inline | side by side (parent: 52bc084)
author | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 11 Sep 2007 18:52:42 +0000 (18:52 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 11 Sep 2007 18:52:42 +0000 (18:52 +0000) |
src/libnr/nr-rect.cpp | patch | blob | history | |
src/libnr/nr-rect.h | patch | blob | history | |
src/selection-chemistry.cpp | patch | blob | history |
diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index 72bced37bb048ca9337d8c03658710f412c2dd81..f3036eff10be3004c73c7a6d93a9e44b1318ef94 100644 (file)
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
return ( _min + _max ) / 2;
}
+Point Rect::cornerFarthestFrom(Point const &p) const {
+ Point m = midpoint();
+ unsigned i = 0;
+ if (p[X] < m[X]) {
+ i = 1;
+ }
+ if (p[Y] < m[Y]) {
+ i = 3 - i;
+ }
+ return corner(i);
+}
+
/** returns a vector from topleft to bottom right. */
Point Rect::dimensions() const {
return _max - _min;
diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h
index 46aff13f4fa938212f39df8654abeaacd1cdcaf5..439538e2998f880d99c1b8c4efc9c92fa310c244 100644 (file)
--- a/src/libnr/nr-rect.h
+++ b/src/libnr/nr-rect.h
/** returns the midpoint of this rect. */
Point midpoint() const;
+ Point cornerFarthestFrom(Point const &p) const;
+
/** True iff either width or height is less than \a epsilon. */
bool isEmpty(double epsilon=1e-6) const {
return isEmpty<X>(epsilon) || isEmpty<Y>(epsilon);
index a8cb4d4fe193096cdf8eaffbd4ce5f9971a27667..251aa6dc04531643d7844a4e00f8c1ba631a6775 100644 (file)
gdouble const zoom = selection->desktop()->current_zoom();
gdouble const zmove = angle / zoom;
- gdouble const r = NR::L2(bbox->max() - *center);
+ gdouble const r = NR::L2(bbox->cornerFarthestFrom(*center) - *center);
gdouble const zangle = 180 * atan2(zmove, r) / M_PI;