34#ifndef SEEN_LIB2GEOM_INTERSECTION_GRAPH_H
35#define SEEN_LIB2GEOM_INTERSECTION_GRAPH_H
39#include <boost/ptr_container/ptr_vector.hpp>
40#include <boost/intrusive/list.hpp>
125 std::size_t
size()
const;
164 boost::intrusive::list_member_hook<>
_hook;
181 typedef boost::intrusive::list
183 , boost::intrusive::member_hook
185 , boost::intrusive::list_member_hook<>
190 typedef boost::intrusive::list
192 , boost::intrusive::member_hook
194 , boost::intrusive::list_member_hook<>
216 struct IntersectionVertexLess;
217 typedef IntersectionList::iterator
ILIter;
218 typedef IntersectionList::const_iterator
CILIter;
233 boost::ptr_vector<IntersectionVertex>
_xs;
Intermediate data for computing Boolean operations on paths.
boost::intrusive::list< IntersectionVertex, boost::intrusive::member_hook< IntersectionVertex, boost::intrusive::list_member_hook<>, &IntersectionVertex::_hook > > IntersectionList
void _assignEdgeWindingParities(Coord precision)
Determine whether path portions between consecutive intersections lie inside or outside of the other ...
void _removeDegenerateIntersections()
Remove intersections that don't change between in/out.
IntersectionList::const_iterator CILIter
boost::ptr_vector< IntersectionVertex > _xs
Stores all crossings between the two shapes.
PathVector getAminusB()
Get the difference of the shapes, A ∖ B.
PathVector getXOR()
Get the symmetric difference of the shapes, A ∆ B.
void _handleNonintersectingPaths(PathVector &result, unsigned which, bool inside)
Select intersection-free path components ahead of a boolean operation based on whether they should be...
PathVector getIntersection()
Get the intersection of the shapes, A ∩ B.
boost::ptr_vector< PathData > _components[2]
Stores the crossing information for the operands.
void _assignComponentStatusFromDegenerateIntersections()
Detect the situation where a path is either entirely inside or entirely outside of the other path-vec...
void fragments(PathVector &in, PathVector &out) const
void _prepareArguments()
Prepare the operands stored in PathIntersectionGraph::_pv by closing all of their constituent paths a...
boost::intrusive::list< IntersectionVertex, boost::intrusive::member_hook< IntersectionVertex, boost::intrusive::list_member_hook<>, &IntersectionVertex::_proc_hook > > UnprocessedList
friend std::ostream & operator<<(std::ostream &, PathIntersectionGraph const &)
Format the PathIntersectionGraph for output.
UnprocessedList _ulist
Temporarily holds all unprocessed during a boolean operation.
std::vector< Point > _winding_points
Stores sample points located on paths of the operand path-vectors, between consecutive intersections.
bool _graph_valid
Whether all intersections are regular.
std::size_t size() const
Returns the number of intersections used when computing Boolean operations.
std::vector< Point > windingPoints() const
Get the geometric points located on path portions between consecutive intersections.
std::vector< Point > intersectionPoints(bool defective=false) const
Get the geometric points where the two path-vectors intersect.
ILIter _getNeighbor(ILIter iter)
Get an iterator to the corresponding crossing on the other path-vector.
void _verify()
Verify that all paths contain an even number of intersections and that the intersection graph does no...
PathVector _pv[2]
Stores the two operand path-vectors, A at _pv[0] and B at _pv[1].
PathData & _getPathData(ILIter iter)
Get the path data for the path containing the intersection given an iterator to the intersection.
PathVector getUnion()
Get the union of the shapes, A ∪ B.
IntersectionList::iterator ILIter
bool _prepareIntersectionLists(Coord precision)
Compute the lists of intersections between the constituent paths of both operands.
PathVector _getResult(bool enter_a, bool enter_b)
Compute the partial result of a boolean operation by looking at components containing intersections a...
PathVector getBminusA()
Get the opposite difference of the shapes, B ∖ A.
Two-dimensional point that doubles as a vector.
Contains forward declarations of 2geom types.
double Coord
Floating point type used to store coordinates.
constexpr Coord EPSILON
Default "acceptably small" value.
Various utility functions.
std::ostream & operator<<(std::ostream &os, const Bezier &b)
PathVector - a sequence of subpaths.
InOutFlag next_edge
Tells us whether the edge originating at this intersection lies inside or outside of the shape given ...
IntersectionVertex * neighbor
A pointer to the corresponding vertex on the other shape.
boost::intrusive::list_member_hook _hook
unsigned which
Index of the operand path-vector that this intersection vertex lies on.
bool defective
Whether the intersection is defective, which means that for some reason the paths neither cross trans...
PathVectorTime pos
Intersection time.
Point p
Geometric position of the intersection point; guarantees that endpoints are exact.
boost::intrusive::list_member_hook _proc_hook
Stores processed intersection information for a single path in an operand path-vector.
IntersectionList xlist
List of crossings on this particular path.
PathData(int w, std::size_t pi)
int which
Index of the path-vector (in PathIntersectionGraph::_pv) that the path belongs to.
std::size_t path_index
Index of the path in its path-vector.
InOutFlag status
Whether this path as a whole is contained INSIDE or OUTSIDE relative to the other path-vector.
Generalized time value in the path vector.