summaryrefslogtreecommitdiffstats
path: root/src/2geom/intersection-graph.h
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-07-04 15:25:59 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2015-07-04 15:25:59 +0000
commit60437ac397d41678daba5daece227240e8ddd364 (patch)
tree31f18c8296ffde9122492b46623375fc98585b17 /src/2geom/intersection-graph.h
parent2Geom CMake adjustment (diff)
downloadinkscape-60437ac397d41678daba5daece227240e8ddd364.tar.gz
inkscape-60437ac397d41678daba5daece227240e8ddd364.zip
Upgrade to 2Geom r2413
(bzr r14059.2.18)
Diffstat (limited to 'src/2geom/intersection-graph.h')
-rw-r--r--src/2geom/intersection-graph.h75
1 files changed, 46 insertions, 29 deletions
diff --git a/src/2geom/intersection-graph.h b/src/2geom/intersection-graph.h
index 44beaf46b..bd9aaee81 100644
--- a/src/2geom/intersection-graph.h
+++ b/src/2geom/intersection-graph.h
@@ -43,33 +43,6 @@
namespace Geom {
-enum InOutFlag {
- POINT_INSIDE,
- POINT_OUTSIDE,
- POINT_ON_EDGE
-};
-
-struct IntersectionVertex {
- boost::intrusive::list_member_hook<> _hook;
- PathVectorTime pos;
- Point p; // guarantees that endpoints are exact
- IntersectionVertex *neighbor;
- bool entry; // going in +t direction enters the other path
- InOutFlag previous;
- InOutFlag next;
- bool processed; // TODO: use intrusive unprocessed list instead
-};
-
-typedef boost::intrusive::list
- < IntersectionVertex
- , boost::intrusive::member_hook
- < IntersectionVertex
- , boost::intrusive::list_member_hook<>
- , &IntersectionVertex::_hook
- >
- > IntersectionList;
-
-
class PathIntersectionGraph
{
// this is called PathIntersectionGraph so that we can also have a class for polygons,
@@ -83,19 +56,63 @@ public:
PathVector getBminusA();
PathVector getXOR();
+ /// Returns the number of intersections used when computing Boolean operations.
+ std::size_t size() const;
std::vector<Point> intersectionPoints() const;
private:
+ enum InOutFlag {
+ POINT_INSIDE,
+ POINT_OUTSIDE
+ };
+
+ struct IntersectionVertex {
+ boost::intrusive::list_member_hook<> _hook;
+ PathVectorTime pos;
+ Point p; // guarantees that endpoints are exact
+ IntersectionVertex *neighbor;
+ bool entry; // going in +t direction enters the other path
+ InOutFlag previous;
+ InOutFlag next;
+ bool processed; // TODO: use intrusive unprocessed list instead
+ };
+
+ typedef boost::intrusive::list
+ < IntersectionVertex
+ , boost::intrusive::member_hook
+ < IntersectionVertex
+ , boost::intrusive::list_member_hook<>
+ , &IntersectionVertex::_hook
+ >
+ > IntersectionList;
+
+ struct PathData {
+ IntersectionList xlist;
+ unsigned removed_in;
+ unsigned removed_out;
+
+ PathData()
+ : removed_in(0)
+ , removed_out(0)
+ {}
+ };
+
+ struct IntersectionVertexLess;
+
PathVector _getResult(bool enter_a, bool enter_b);
void _handleNonintersectingPaths(PathVector &result, int which, bool inside);
bool _findUnprocessed(IntersectionList::iterator &result);
PathVector _a, _b;
boost::ptr_vector<IntersectionVertex> _xs;
- boost::ptr_vector<IntersectionList> _xalists;
- boost::ptr_vector<IntersectionList> _xblists;
+ boost::ptr_vector<PathData> _apaths;
+ boost::ptr_vector<PathData> _bpaths;
+
+ friend std::ostream &operator<<(std::ostream &, PathIntersectionGraph const &);
};
+std::ostream &operator<<(std::ostream &os, PathIntersectionGraph const &pig);
+
} // namespace Geom
#endif // SEEN_LIB2GEOM_PATH_GRAPH_H