From aecd10f6302e9071ca287e28bda81a0c522de089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 5 Nov 2023 19:11:40 +0100 Subject: [PATCH] Fixex shape fixer on intersection failure --- .../com/jpexs/decompiler/flash/math/BezierEdge.java | 11 ++++++++++- .../jpexs/decompiler/flash/math/Intersections.java | 10 ++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/BezierEdge.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/BezierEdge.java index 45f607675..1469480eb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/BezierEdge.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/BezierEdge.java @@ -478,8 +478,17 @@ public class BezierEdge implements Serializable { BezierEdge qg = new BezierEdge(-66, 139, -67, 140, -61, 135); BezierEdge qh = new BezierEdge(-64, 169, -66.5, 139.5, -66, 139); + //Error Y values of bounds must be of opposite sign + BezierEdge qi = new BezierEdge(6369.0, 13040.0, 6380.0, 13030.0, 6427.0, 13018.0); + BezierEdge qj = new BezierEdge(6338.0, 13099.0, 6358.0, 13050.0, 6369.0, 13040.0); + + + //Error Y values of bounds must be of opposite sign + BezierEdge qk = new BezierEdge(45334.0, 2421.0, 45348.0, 2373.0, 45348.0, 2330.0); + BezierEdge ql = new BezierEdge(45348.0, 2330.0, 45348.0, 2263.0, 45314.0, 2223.0); + List ps = new ArrayList<>(); - qg.intersects(qh, t1, t2, ps); + qk.intersects(ql, t1, t2, ps); System.err.println("t1 is " + t1); System.err.println("t2 is " + t2); System.err.println("intersections is " + ps); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/Intersections.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/Intersections.java index f9b88f868..79fc89aa8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/Intersections.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/math/Intersections.java @@ -211,8 +211,14 @@ public class Intersections { try { roots = poly.getRoots(); } catch (RuntimeException rex) { - //Y values of bounds must be of opposite sign. ??fixme?? - return result; + /* + Y values of bounds must be of opposite sign. ??fixme?? + + Samples where this happens: + M 6369 13040 Q 6380 13030 6427 13018 and M 6338 13099 Q 6358 13050 6369 13040 + M 6369 13040 Q 6380 13030 6427 13018 and M 6338 13099 Q 6358 13050 6369 13040 + */ + roots = new ArrayList<>(); } for (double s : roots) { if (0 <= s && s <= 1) {