/*
5 * Authors: see git history
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
133 void Reset(
int n = 0,
int m = 0);
157 int AddEdge(
int st,
int en,
int leF,
int riF);
181 inline int Other(
int p,
int b)
const
223 }
else if (p ==
getEdge(b).en) {
242 }
else if (p ==
getEdge(b).en) {
260 void CalcBBox(
bool strict_degree =
false);
263 void Plot(
double ix,
double iy,
double ir,
double mx,
double my,
bool doPoint,
264 bool edgesNo,
bool pointNo,
bool doDir,
char *fileName);
350 inline static double Round(
double x)
352 return ldexp(rint(ldexp(x, 9)), -9);
415 void Scan(
float &pos,
int &curP,
float to,
float step);
417 void Scan(
float &pos,
int &curP,
float to,
FloatLigne *line,
bool exact,
float step);
420 {
for(
auto & _pt :
_pts) _pt.x*=tr;}
637 void _countUpDown(
int P,
int *numberUp,
int *numberDown,
int *upEdge,
int *downEdge)
const;
861 void AddChgt(
int lastPointNo,
int lastChgtPt,
Shape *&shapeHead,
981 void DoEdgeTo(
Shape *iS,
int iB,
int iTo,
bool direct,
bool sens);
1044 void CreateEdge(
int no,
float to,
float step);
1045 void AvanceEdge(
int no,
float to,
bool exact,
float step);
Cartesian point / 2D vector and related operations.
TODO: insert short description here.
bool distanceLessThanOrEqual(Shape const *s, Geom::Point const &p, double const max_l2)
Returns true iff the L2 distance from thePt to this shape is <= max_l2.
double distance(Shape const *s, Geom::Point const &p)
bool directedEulerian(Shape const *s)
Is the graph Eulerian?
Coverage with floating-point boundaries.
3x3 matrix representing an affine transformation.
Two-dimensional point that doubles as a vector.
Path and its polyline approximation.
A class to store/manipulate directed graphs.
bool _has_edges_data
the eData array is allocated
void DoEdgeTo(Shape *iS, int iB, int iTo, bool direct, bool sens)
Draw edge to a passed point.
int PushIncidence(Shape *a, int cb, int pt, double theta)
void MakeSweepDestData(bool nVal)
Initialize the sweep destination data cache.
void AddChgt(int lastPointNo, int lastChgtPt, Shape *&shapeHead, int &edgeHead, sTreeChangeType type, Shape *lS, int lB, Shape *rS, int rB)
Add the event in chgts.
void AddContour(Path *dest, int num_orig, Path *const *orig, int start_edge, bool never_split=false)
Add a contour.
std::vector< sweep_src_data > swsData
int Other(int p, int b) const
sTreeChangeType
Enum describing all the events that can happen to a sweepline.
void CheckAdjacencies(int lastPointNo, int lastChgtPt, Shape *shapeHead, int edgeHead)
If there are points that lie on edges, mark this by modifying leftRnd and rightRnd variables.
void ResetSweep()
Prepare point data cache, edge data cache and sweep source cache.
void CreateEdge(int no, float to, float step)
void ConvertToForme(Path *dest)
Extract contours from a directed graph.
void AssembleAretes(FillRule directed=fill_nonZero)
void needEdgesSorting()
Do the edges need sorting?
int Booleen(Shape *a, Shape *b, BooleanOp mod, int cutPathID=-1)
void _updateIntersection(int e, int p)
void needPointsSorting()
Do the points need sorting?
void Scan(float &pos, int &curP, float to, float step)
void MakeBackData(bool nVal)
bool _point_data_initialised
the pData array is up to date
std::vector< sTreeChange > chgts
void MakeSweepSrcData(bool nVal)
Initialize the sweep source data cache.
void DisconnectStart(int b)
void SwapEdges(int a, int b)
void Plot(double ix, double iy, double ir, double mx, double my, bool doPoint, bool edgesNo, bool pointNo, bool doDir, char *fileName)
void _countUpDown(int P, int *numberUp, int *numberDown, int *upEdge, int *downEdge) const
int AddEdge(int st, int en)
int CyclePrevAt(int p, int b) const
int PtWinding(const Geom::Point px) const
bool _has_sweep_src_data
the swsData array is allocated
int PrevAt(int p, int b) const
bool hasPoints() const
Do we have points?
std::vector< raster_data > swrData
void SortPoints()
Sort the points (all points) only if needed.
bool TesteAdjacency(Shape *iL, int ilb, const Geom::Point atx, int nPt, bool push)
void SortEdgesList(edge_list *edges, int s, int e)
Sort edges given in a list.
bool _bbox_up_to_date
the leftX/rightX/topY/bottomY are up to date
int CycleNextAt(int p, int b) const
void CheckEdges(int lastPointNo, int lastChgtPt, Shape *a, Shape *b, BooleanOp mod)
Check if there are edges to draw and draw them.
bool _need_points_sorting
points have been added or removed: we need to sort the points again
std::vector< back_data > ebData
static double IHalfRound(double x)
static int CmpToVert(const Geom::Point ax, const Geom::Point bx, bool as, bool bs)
Edge comparison function.
void MakePointData(bool nVal)
Initialize the point data cache.
bool _need_edges_sorting
edges have been added: maybe they are not ordered clockwise
int ReFormeLineTo(int bord, Path *dest, bool never_split)
void Copy(Shape *a)
Copy point and edge data from ‘who’ into this object, discarding any cached data that we have.
void Avance(int lastPointNo, int lastChgtPt, Shape *iS, int iB, Shape *a, Shape *b, BooleanOp mod)
Do the edge.
static double HalfRound(double x)
void CalcBBox(bool strict_degree=false)
void ConvertToFormeNested(Path *dest, int nbP, Path *const *orig, int &nbNest, int *&nesting, int *&contStart, bool never_split=false)
int numberOfEdges() const
Returns number of edges.
void ConnectEnd(int p, int b)
void CleanupSweep()
Clear point data cache, edge data cache and sweep source cache.
static double Round(double x)
void BeginRaster(float &pos, int &curPt)
void Transform(Geom::Affine const &tr)
std::vector< edge_data > eData
int NextAt(int p, int b) const
int numberOfPoints() const
Returns number of points.
bool _has_points_data
the pData array is allocated
bool hasEdges() const
Do we have edges?
void SwapPoints(int a, int b)
void AvanceEdge(int no, float to, bool exact, float step)
dg_arete const & getEdge(int n) const
Get an edge.
void SortEdges()
Sort all edges (clockwise) around each point.
void SortPointsByOldInd(int s, int e)
Sort the points (take oldInd into account)
void MakeRasterData(bool nVal)
int MakeTweak(int mode, Shape *a, double dec, JoinType join, double miter, bool do_profile, Geom::Point c, Geom::Point vector, double radius, Geom::Affine *i2doc)
void Reset(int n=0, int m=0)
Clear all data.
void initialiseEdgeData()
void SortPointsRounded()
Sort all points by their rounded coordinates.
std::vector< dg_point > _pts
int MakeOffset(Shape *of, double dec, JoinType join, double miter, bool do_profile=false, double cx=0, double cy=0, double radius=0, Geom::Affine *i2doc=nullptr)
void GetWindings(bool brutal=false)
Calculates the winding numbers to the left and right of all edges of this shape.
void _countUpDownTotalDegree2(int P, int *numberUp, int *numberDown, int *upEdge, int *downEdge) const
Version of Shape::_countUpDown optimised for the case when getPoint(P).totalDegree() == 2.
int ConvertToShape(Shape *a, FillRule directed=fill_nonZero, bool invert=false)
Using a given fill rule, find all intersections in the shape given, create a new intersection free sh...
bool _has_raster_data
the swrData array is allocated
int ReFormeArcTo(int bord, Path *dest, Path *orig, bool never_split)
void ConnectStart(int p, int b)
std::vector< dg_arete > _aretes
int AddPoint(const Geom::Point x)
void MakeEdgeData(bool nVal)
Initialize the edge data cache.
void TesteIntersection(SweepTree *t, Side s, bool onlyDiff)
Test if there is an intersection of an edge on a particular side.
void clearIncidenceData()
bool _has_sweep_dest_data
the swdData array is allocated
void DestroyEdge(int no, float to, FloatLigne *line)
int Winding(const Geom::Point px) const
Compute the winding number of the point given.
dg_point const & getPoint(int n) const
Get a point.
std::vector< sweep_dest_data > swdData
void initialisePointData()
bool hasBackData() const
Do we have back data?
void AssemblePoints(Shape *a)
int ReFormeCubicTo(int bord, Path *dest, Path *orig, bool never_split)
void DisconnectEnd(int b)
int CreateIncidence(Shape *a, int cb, int pt)
std::vector< point_data > pData
The structure to hold the intersections events encountered during the sweep.
An intersection event structure to record any intersections that are detected (predicted) during the ...
The sweepline tree to store a linear sequence of edges that intersect with the sweepline in the exact...
One node in the AVL tree of edges.
Edges edges(Path const &p, Crossings const &cr, unsigned ix)
void invert(const double v[16], double alpha[16])
A structure to store back data for an edge.
An edge in the directed graph.
A point or vertex in the directed graph.
Extra data that some algorithms use.
A structure to help with sorting edges around a point.
Extra data for points used at various occasions.
A structure that represents a change that took place in the sweepline.