improve Bezier4P calculations for CPython implementation
This uses the first control point as offset and stores
the curve with start point = origin = (0, 0, 0).
This avoids floating point errors with large coordinates
(like if the control points are "close" together
but are located in "outer space" (elevation issue).
@@ -126,7 +126,8 @@ def test_correctness_bezier_from_ellipse(s, e):
expected = list(cubic_bezier_from_ellipse(ellipse))
result = list(bezier.cubic_bezier_from_ellipse(ellipse))
for e, r in zip(expected, result):
- assert e.control_points == r.control_points
+ for ep, rp in zip(e.control_points, r.control_points):
+ assert ep.isclose(rp)
if __name__ == "__main__":
