bezier
bezier copied to clipboard
BUG: "Unexpected number of edges" occurs with triangles sharing an edge
The exact representations of the (linear) triangles are:
import numpy as np
nodes1 = np.asfortranarray([
[
float.fromhex("-0x1.8000000000000p-1"),
float.fromhex("-0x1.9555555555556p-1"),
float.fromhex("-0x1.8000000000000p-1"),
],
[
float.fromhex("0x1.0000000000000p+0"),
float.fromhex("0x1.eaaaaaaaaaaaap-1"),
float.fromhex("0x1.eaaaaaaaaaaaap-1"),
],
])
nodes2 = np.asfortranarray([
[
float.fromhex("-0x1.924924924924ap-1"),
float.fromhex("-0x1.a492492492493p-1"),
float.fromhex("-0x1.924924924924ap-1"),
],
[
float.fromhex("0x1.edb6db6db6db7p-1"),
float.fromhex("0x1.db6db6db6db6ep-1"),
float.fromhex("0x1.db6db6db6db6ep-1"),
],
])
(I will clean this report up ~shortly~ at some point, currently in the middle of another task.)
Three of the four detected intersections are corners and one of these is not exact:
>>> [[v for v in r] for r in edges1[0].intersect(edges2[0])]
[[0.8571428571428565, 1.0], [0.0, 0.16666666666666774]]
>>> [[v for v in r] for r in edges1[0].intersect(edges2[2])]
[[0.8571428571428579], [0.9999999999999969]]
>>> [[v for v in r] for r in edges1[1].intersect(edges2[2])]
[[0.1428571428571421], [0.8333333333333307]]
The error is 3.1086244689504383e-15
, which is likely below some "round to 0
or 1
" threshold.