diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2015-05-22 08:23:27 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2015-05-22 08:23:27 +0000 |
| commit | 25fa09178b7d0d0befa708e93ea5316ef381caa0 (patch) | |
| tree | 550b4d0d66d0d234b3f49e868cb747987dcc6bf8 /src/2geom/intersection.h | |
| parent | Merge from trunk (diff) | |
| download | inkscape-25fa09178b7d0d0befa708e93ea5316ef381caa0.tar.gz inkscape-25fa09178b7d0d0befa708e93ea5316ef381caa0.zip | |
Update to 2Geom revision 2396
(bzr r14059.2.16)
Diffstat (limited to 'src/2geom/intersection.h')
| -rw-r--r-- | src/2geom/intersection.h | 20 |
1 files changed, 19 insertions, 1 deletions
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 <typename T> struct ShapeTraits { typedef Coord TimeType; @@ -101,6 +101,24 @@ struct ShapeTraits { typedef Intersection<> IntersectionType; }; +template <typename A, typename B> inline +std::vector< Intersection<A, B> > transpose(std::vector< Intersection<B, A> > const &in) { + std::vector< Intersection<A, B> > result; + for (std::size_t i = 0; i < in.size(); ++i) { + result.push_back(Intersection<A, B>(in[i].second, in[i].first, in[i].point())); + } + return result; +} + +template <typename T> inline +void transpose_in_place(std::vector< Intersection<T, T> > &xs) { + for (std::size_t i = 0; i < xs.size(); ++i) { + std::swap(xs[i].first, xs[i].second); + } +} + +typedef Intersection<> ShapeIntersection; + } // namespace Geom |
