summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d7eebb)
raw | patch | inline | side by side (parent: 2d7eebb)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 23 Dec 2007 21:52:23 +0000 (21:52 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 23 Dec 2007 21:52:23 +0000 (21:52 +0000) |
src/sp-guide.cpp | patch | blob | history | |
src/sp-guide.h | patch | blob | history |
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 7ee29e2316e7f6d4e7e78ccb853ebd699b4307e1..26d60601c58d002ff2c4767f1a35af0341ddb52d 100644 (file)
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
#include "inkscape.h"
#include "desktop.h"
#include "sp-namedview.h"
+#include <2geom/angle.h>
using std::vector;
} else if ( guide->normal_to_line == component_vectors[Y] ) {
return g_strdup_printf(_("horizontal guideline at %s"), position_string_y->str);
} else {
- double const radians = atan2(guide->normal_to_line[X],
- guide->normal_to_line[Y]);
- /* flip y axis and rotate 90 degrees to convert to line angle */
- double const degrees = ( radians / M_PI ) * 180.0;
- int const degrees_int = (int) floor( degrees + .5 );
+ double const radians = guide->angle();
+ double const degrees = Geom::rad_to_deg(radians);
+ int const degrees_int = (int) round(degrees);
return g_strdup_printf("%d degree guideline at (%s,%s)", degrees_int, position_string_x->str, position_string_y->str);
/* Alternative suggestion: "angled guideline". */
}
diff --git a/src/sp-guide.h b/src/sp-guide.h
index 819457cb7a776a95ce393fe6bb3fa55c8213c211..dbbebadb7aee63e97b5bff94fd7517b7804c25e4 100644 (file)
--- a/src/sp-guide.h
+++ b/src/sp-guide.h
inline bool is_horizontal() const { return (normal_to_line[Geom::X] == 0.); };
inline bool is_vertical() const { return (normal_to_line[Geom::Y] == 0.); };
+ inline double angle() const { return std::atan2( - normal_to_line[Geom::X], normal_to_line[Geom::Y] ); };
};
struct SPGuideClass {