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/intersection.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/2geom/intersection.h') diff --git a/src/2geom/intersection.h b/src/2geom/intersection.h index 848797682..ae4b50dd1 100644 --- a/src/2geom/intersection.h +++ b/src/2geom/intersection.h @@ -92,7 +92,7 @@ private: }; -// TODO: move into new header +// TODO: move into new header? template struct ShapeTraits { typedef Coord TimeType; @@ -101,6 +101,24 @@ struct ShapeTraits { typedef Intersection<> IntersectionType; }; +template inline +std::vector< Intersection > transpose(std::vector< Intersection > const &in) { + std::vector< Intersection > result; + for (std::size_t i = 0; i < in.size(); ++i) { + result.push_back(Intersection(in[i].second, in[i].first, in[i].point())); + } + return result; +} + +template inline +void transpose_in_place(std::vector< Intersection > &xs) { + for (std::size_t i = 0; i < xs.size(); ++i) { + std::swap(xs[i].first, xs[i].second); + } +} + +typedef Intersection<> ShapeIntersection; + } // namespace Geom -- cgit v1.2.3