summaryrefslogtreecommitdiffstats
path: root/src/2geom
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-31 10:57:18 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-31 10:57:18 +0000
commit04019f73cb42d7b23bfe8c51137d5e84f25223cf (patch)
treeca0db6e97de907ffcf2ea1f6b7565ff38c6795c4 /src/2geom
parentend append path (diff)
parentUpdating Potrace from 1.10 to 1.12, fixing Bug #1438366 (CVE-2013-7437 vulner... (diff)
downloadinkscape-04019f73cb42d7b23bfe8c51137d5e84f25223cf.tar.gz
inkscape-04019f73cb42d7b23bfe8c51137d5e84f25223cf.zip
update to trunk
(bzr r13645.1.58)
Diffstat (limited to 'src/2geom')
-rw-r--r--src/2geom/line.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/2geom/line.h b/src/2geom/line.h
index ade67f818..cbd68fa08 100644
--- a/src/2geom/line.h
+++ b/src/2geom/line.h
@@ -35,6 +35,7 @@
#define LIB2GEOM_SEEN_LINE_H
#include <cmath>
+#include <iostream>
#include <boost/optional.hpp>
#include <2geom/bezier-curve.h> // for LineSegment
#include <2geom/rect.h>
@@ -258,9 +259,19 @@ public:
dist = -dot(n, m_origin);
return n;
}
- /// @}
+
+ friend inline std::ostream &operator<< (std::ostream &out_file, const Geom::Line &in_line);
+/// @}
}; // end class Line
+/** @brief Output operator for lines.
+ * Prints out representation (point + versor)
+ */
+inline std::ostream &operator<< (std::ostream &out_file, const Geom::Line &in_line) {
+ out_file << "X: " << in_line.m_origin[X] << " Y: " << in_line.m_origin[Y]
+ << " dX: " << in_line.m_versor[X] << " dY: " << in_line.m_versor[Y];
+ return out_file;
+}
inline
double distance(Point const& _point, Line const& _line)
@@ -365,6 +376,10 @@ inline
Line make_angle_bisector_line(Point const& A, Point const& O, Point const& B)
{
Point M = middle_point(A,B);
+ if (are_near(O,M)) {
+ Line l(A,B);
+ M += (make_orthogonal_line(O,l)).versor();
+ }
return Line(O,M);
}