From 35314a6e92fd4de46b6b67a778d2097c644f8e99 Mon Sep 17 00:00:00 2001 From: Wei-Hsin Yeh Date: Mon, 19 Aug 2024 23:58:22 +0800 Subject: [PATCH] Add principle of checking the spline to comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The way of checking the spline is flat or not is to calculate the distance from a control point to the line connected by the point A and point D, which is based on the Convex Hull Property of Bézier Curves that Bézier Curve lies within the convex hull of its control points. --- src/spline.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/spline.c b/src/spline.c index 3f99881..28d84b6 100644 --- a/src/spline.c +++ b/src/spline.c @@ -57,7 +57,10 @@ static void _de_casteljau(twin_spline_t *spline, /* * Return an upper bound on the distance (squared) that could result from - * approximating a spline with a line segment connecting the two endpoints. + * approximating a spline with a line segment connecting the two endpoints, + * which is based on the Convex Hull Property of Bézier Curves: The Bézier Curve + * lies completely in the convex hull of the given control points. Therefore, we + * can use control points B and C to approximate the actual spline. */ static twin_dfixed_t _twin_spline_distance_squared(twin_spline_t *spline) {