Skip to content

Commit

Permalink
Add principle of checking the spline to comment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weihsinyeh committed Sep 7, 2024
1 parent e910b34 commit 35314a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/spline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 35314a6

Please sign in to comment.