diff --git a/src/2geom/point.cpp b/src/2geom/point.cpp
index 5dd7b52f295126b468f76d49e239202d561566cb..b8a858f8d48d6f9910441a93100cef69a9a8a743 100644 (file)
--- a/src/2geom/point.cpp
+++ b/src/2geom/point.cpp
#include <assert.h>
#include <2geom/coord.h>
#include <2geom/isnan.h> //temporary fix for isnan()
-#include <2geom/matrix.h>
+#include <2geom/transforms.h>
namespace Geom {
return *this;
}
+Point constrain_angle(Point const &ref, Point const &pt, unsigned int n, Point const &dir)
+{
+ // for special cases we could perhaps use faster routines
+ if (n == 0.0) {
+ return pt;
+ }
+ Point diff(pt - ref);
+ double angle = -angle_between(diff, dir);
+ double k = round(angle * (double)n / (2.0*M_PI));
+ return ref + dir * Rotate(k * 2.0 * M_PI / (double)n) * L2(diff);
+}
+
} //Namespace Geom
/*