diff options
author | Rafael Laboissière <rafael@debian.org> | 2024-03-23 11:24:15 -0300 |
---|---|---|
committer | Rafael Laboissière <rafael@debian.org> | 2024-03-23 11:24:15 -0300 |
commit | 884b6b50c50abfb633b52f567009c0460b27fbf9 (patch) | |
tree | 820e022ff3ac93c30cda3817c814ecbf1f741f6d /src | |
parent | a45e15f167ef0a7cba3e9ed572209f3522658320 (diff) |
New upstream version 4.1.0
Diffstat (limited to 'src')
-rw-r--r-- | src/clipper.cpp | 3 | ||||
-rw-r--r-- | src/martinez.cpp | 4 | ||||
-rw-r--r-- | src/martinez.h | 4 | ||||
-rw-r--r-- | src/polygon.cpp | 6 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/clipper.cpp b/src/clipper.cpp index 1b10300..7c9ef05 100644 --- a/src/clipper.cpp +++ b/src/clipper.cpp @@ -747,7 +747,8 @@ void DisposeOutPts(OutPt*& pp) inline void InitEdge(TEdge* e, TEdge* eNext, TEdge* ePrev, const IntPoint& Pt) { - std::memset(e, 0, sizeof(TEdge)); + //std::memset(e, 0, sizeof(TEdge)); + *e = {}; e->Next = eNext; e->Prev = ePrev; e->Curr = Pt; diff --git a/src/martinez.cpp b/src/martinez.cpp index 52558b3..d981597 100644 --- a/src/martinez.cpp +++ b/src/martinez.cpp @@ -26,7 +26,7 @@ void Martinez::print (SweepEvent& e) // Compare two sweep events // Return true means that e1 is placed at the event queue after e2, i.e,, e1 is processed by the algorithm after e2 -bool Martinez::SweepEventComp::operator() (SweepEvent* e1, SweepEvent* e2) { +bool Martinez::SweepEventComp::operator() (SweepEvent* e1, SweepEvent* e2) const { if (e1->p.x > e2->p.x) // Different x-coordinate return true; if (e2->p.x > e1->p.x) // Different x-coordinate @@ -40,7 +40,7 @@ bool Martinez::SweepEventComp::operator() (SweepEvent* e1, SweepEvent* e2) { } // e1 and a2 are the left events of line segments (e1->p, e1->other->p) and (e2->p, e2->other->p) -bool Martinez::SegmentComp::operator() (SweepEvent* e1, SweepEvent* e2) { +bool Martinez::SegmentComp::operator() (SweepEvent* e1, SweepEvent* e2) const { if (e1 == e2) return false; if (signedArea (e1->p, e1->other->p, e2->p) != 0 || signedArea (e1->p, e1->other->p, e2->other->p) != 0) { diff --git a/src/martinez.h b/src/martinez.h index 3275171..307f5bd 100644 --- a/src/martinez.h +++ b/src/martinez.h @@ -38,7 +38,7 @@ private: struct SweepEvent; struct SegmentComp : public binary_function<SweepEvent*, SweepEvent*, bool> { // for sorting edges in the sweep line - bool operator() (SweepEvent* e1, SweepEvent* e2); + bool operator() (SweepEvent* e1, SweepEvent* e2) const; }; struct SweepEvent { @@ -65,7 +65,7 @@ private: static void print (SweepEvent& e); // This function is intended for debugging purposes struct SweepEventComp : public binary_function<SweepEvent*, SweepEvent*, bool> { // for sortening events - bool operator() (SweepEvent* e1, SweepEvent* e2); + bool operator() (SweepEvent* e1, SweepEvent* e2) const; }; /** @brief Event Queue */ diff --git a/src/polygon.cpp b/src/polygon.cpp index 63628c5..17b4cff 100644 --- a/src/polygon.cpp +++ b/src/polygon.cpp @@ -94,7 +94,7 @@ void Polygon::move (double x, double y) namespace { // start of anonymous namespace struct SweepEvent; struct SegmentComp : public binary_function<SweepEvent*, SweepEvent*, bool> { - bool operator() (SweepEvent* e1, SweepEvent* e2); + bool operator() (SweepEvent* e1, SweepEvent* e2) const; }; struct SweepEvent { @@ -117,7 +117,7 @@ namespace { // start of anonymous namespace }; struct SweepEventComp : public binary_function<SweepEvent*, SweepEvent*, bool> { - bool operator() (SweepEvent* e1, SweepEvent* e2) { + bool operator() (SweepEvent* e1, SweepEvent* e2) const { if (e1->p.x < e2->p.x) // Different x coordinate return true; if (e2->p.x < e1->p.x) // Different x coordinate @@ -133,7 +133,7 @@ namespace { // start of anonymous namespace } // end of anonymous namespace -bool SegmentComp::operator() (SweepEvent* e1, SweepEvent* e2) { +bool SegmentComp::operator() (SweepEvent* e1, SweepEvent* e2) const { if (e1 == e2) return false; if (signedArea (e1->p, e1->other->p, e2->p) != 0 || signedArea (e1->p, e1->other->p, e2->other->p) != 0) { |