summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee4b465)
raw | patch | inline | side by side (parent: ee4b465)
author | Johan Engelen <goejendaagh@zonnet.nl> | |
Wed, 27 Oct 2010 23:14:51 +0000 (01:14 +0200) | ||
committer | Johan Engelen <goejendaagh@zonnet.nl> | |
Wed, 27 Oct 2010 23:14:51 +0000 (01:14 +0200) |
src/2geom/crossing.cpp | patch | blob | history | |
src/2geom/crossing.h | patch | blob | history |
diff --git a/src/2geom/crossing.cpp b/src/2geom/crossing.cpp
index d717a4ed560c6dbe4b3b17e37caf3ea3288efa84..91180a939f8b076b8e52b6a925d8080b86994f1b 100644 (file)
--- a/src/2geom/crossing.cpp
+++ b/src/2geom/crossing.cpp
@@ -113,6 +113,18 @@ CrossingGraph create_crossing_graph(std::vector<Path> const &p, Crossings const
*/
//}
+// provide specific method for Paths because paths can be closed or open. Path::size() is named somewhat wrong...
+std::vector<Rect> bounds(Path const &a) {
+ std::vector<Rect> rs;
+ for (unsigned i = 0; i < a.size_default(); i++) {
+ OptRect bb = a[i].boundsFast();
+ if (bb) {
+ rs.push_back(*bb);
+ }
+ }
+ return rs;
+}
+
void merge_crossings(Crossings &a, Crossings &b, unsigned i) {
Crossings n;
sort_crossings(b, i);
diff --git a/src/2geom/crossing.h b/src/2geom/crossing.h
index 427848033dc22150733afaad60d43bd5e8785f26..593ce366257f5c4edec007601d1cfd9baf43a7b9 100644 (file)
--- a/src/2geom/crossing.h
+++ b/src/2geom/crossing.h
#include <2geom/rect.h>
#include <2geom/sweep.h>
#include <boost/optional/optional.hpp>
+#include <2geom/path.h>
namespace Geom {
}
return rs;
}
+// provide specific method for Paths because paths can be closed or open. Path::size() is named somewhat wrong...
+std::vector<Rect> bounds(Path const &a);
inline void sort_crossings(Crossings &cr, unsigned ix) { std::sort(cr.begin(), cr.end(), CrossingOrder(ix)); }