public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/earcut-hpp] f45: Patch for degenerate edges
@ 2026-09-09  8:56 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-09-09  8:56 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/earcut-hpp
Branch : f45
Commit : c00e2a744ebf1573c81d76a057365be8574d5a74
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-09-09T09:54:52+01:00
Stats  : +67/-0 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/earcut-hpp/c/c00e2a744ebf1573c81d76a057365be8574d5a74?branch=f45

Log:
Patch for degenerate edges

---
diff --git a/136.patch b/136.patch
new file mode 100644
index 0000000..2d6a3e1
--- /dev/null
+++ b/136.patch
@@ -0,0 +1,29 @@
+From 99cef86716b50e4fe529b6c0aae3e994758848c9 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Wed, 9 Sep 2026 07:34:30 +0100
+Subject: [PATCH] Include `type_traits` header for `std::decay`
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Don’t rely on indirect/implicit inclusion via other standard-library
+headers.
+
+This minor omission was originally pointed out by Copilot in
+https://github.com/skogler/mapbox_earcut_python/pull/32.
+---
+ include/mapbox/earcut.hpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/mapbox/earcut.hpp b/include/mapbox/earcut.hpp
+index 84f8bd5..1f8b6da 100644
+--- a/include/mapbox/earcut.hpp
++++ b/include/mapbox/earcut.hpp
+@@ -7,6 +7,7 @@
+ #include <cstdint>
+ #include <limits>
+ #include <memory>
++#include <type_traits>
+ #include <utility>
+ #include <vector>
+ 

diff --git a/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch b/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch
new file mode 100644
index 0000000..2b39749
--- /dev/null
+++ b/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch
@@ -0,0 +1,30 @@
+From c0c5ecb6bd1f43ad1f5b005e846221e524d9214d Mon Sep 17 00:00:00 2001
+From: Neil Chatterjee <55393285+skeptopic@users.noreply.github.com>
+Date: Tue, 7 Jul 2026 10:07:38 +0200
+Subject: [PATCH] Guard against degenerate edges (#134)
+
+JS Array#Sort doesn't bomb on NaN, but std::sort does
+---
+ include/mapbox/earcut.hpp | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/include/mapbox/earcut.hpp b/include/mapbox/earcut.hpp
+index 2bd03b4..b4450db 100644
+--- a/include/mapbox/earcut.hpp
++++ b/include/mapbox/earcut.hpp
+@@ -561,9 +561,12 @@ typename Earcut<N>::Node* Earcut<N>::eliminateHoles(const Polygon& points, Node*
+     std::sort(holeQueue.begin(), holeQueue.end(), [](const Node* a, const Node* b) {
+         if (a->x != b->x) return a->x < b->x;
+         if (a->y != b->y) return a->y < b->y;
+-        const double aSlope = (a->next->y - a->y) / (a->next->x - a->x);
+-        const double bSlope = (b->next->y - b->y) / (b->next->x - b->x);
+-        return aSlope < bSlope;
++        const double adx = a->next->x - a->x, ady = a->next->y - a->y;
++        const double bdx = b->next->x - b->x, bdy = b->next->y - b->y;
++        const bool aDegenerate = adx == 0 && ady == 0;
++        const bool bDegenerate = bdx == 0 && bdy == 0;
++        if (aDegenerate != bDegenerate) return aDegenerate;
++        return ady * bdx < bdy * adx;
+     });
+ 
+     // block-bbox index for findHoleBridge, grown append-only as holes merge. Seed it with the

diff --git a/earcut-hpp.spec b/earcut-hpp.spec
index dcc3934..ee160bd 100644
--- a/earcut-hpp.spec
+++ b/earcut-hpp.spec
@@ -15,6 +15,14 @@ Source0:        %{url}/archive/v%{version}/earcut.hpp-%{version}.tar.gz
 # not contribute to the binary RPMs.
 Source1:        https://github.com/mapbox/earcut/archive/v%{version}/earcut-%{version}.tar.gz
 
+# Include `type_traits` header for `std::decay`
+# https://github.com/mapbox/earcut.hpp/pull/136
+Patch:          %{url}/pull/136.patch
+# Guard against degenerate edges
+# https://github.com/mapbox/earcut.hpp/commit/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d
+# See discussion in https://github.com/skogler/mapbox_earcut_python/pull/32.
+Patch:          %{url}/commit/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch
+
 BuildSystem:    cmake
 # We do want to build the tests, but we have no use for the benchmarks or the
 # visualizer program.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-09  8:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09  8:56 [rpms/earcut-hpp] f45: Patch for degenerate edges Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox