From c883d7627a479c8c5b6a9f77b9841fa5631572ad Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 27 Apr 2015 19:39:29 -0400 Subject: 2Geom sync - initial commit (bzr r14059.2.1) --- src/2geom/point.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/2geom/point.cpp') diff --git a/src/2geom/point.cpp b/src/2geom/point.cpp index b0b00b5da..e2662becd 100644 --- a/src/2geom/point.cpp +++ b/src/2geom/point.cpp @@ -146,8 +146,8 @@ bool is_zero(Point const &p) { /** @brief True if the point has a length near 1. The are_near() function is used. * @relates Point */ -bool is_unit_vector(Point const &p) { - return are_near(L2(p), 1.0); +bool is_unit_vector(Point const &p, Coord eps) { + return are_near(L2(p), 1.0, eps); } /** @brief Return the angle between the point and the +X axis. * @return Angle in \f$(-\pi, \pi]\f$. @@ -161,7 +161,7 @@ Coord atan2(Point const &p) { * @return Angle in \f$(-\pi, \pi]\f$. * @relates Point */ Coord angle_between(Point const &a, Point const &b) { - return std::atan2(cross(b,a), dot(b,a)); + return std::atan2(cross(a,b), dot(a,b)); } /** @brief Create a normalized version of a point. -- cgit v1.2.3 From 25fa09178b7d0d0befa708e93ea5316ef381caa0 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Fri, 22 May 2015 10:23:27 +0200 Subject: Update to 2Geom revision 2396 (bzr r14059.2.16) --- src/2geom/point.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/2geom/point.cpp') diff --git a/src/2geom/point.cpp b/src/2geom/point.cpp index e2662becd..bcdbab429 100644 --- a/src/2geom/point.cpp +++ b/src/2geom/point.cpp @@ -35,6 +35,7 @@ #include #include +#include <2geom/coord.h> #include <2geom/point.h> #include <2geom/transforms.h> @@ -230,6 +231,13 @@ Point constrain_angle(Point const &A, Point const &B, unsigned int n, Point cons return A + dir * Rotate(k * 2.0 * M_PI / (double)n) * L2(diff); } +std::ostream &operator<<(std::ostream &out, const Geom::Point &p) +{ + out << "(" << format_coord_nice(p[X]) << ", " + << format_coord_nice(p[Y]) << ")"; + return out; +} + } // end namespace Geom /* -- cgit v1.2.3