diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2020-12-16 14:39:42 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2020-12-16 14:39:42 +0100 |
commit | 4f262d6540281487f79870aff589ca92f5d2f6c6 (patch) | |
tree | 940e59d943715366d1aa72bb93f248dcd65ab992 /curves/bezier.mli |
Initial commit
Diffstat (limited to 'curves/bezier.mli')
-rwxr-xr-x | curves/bezier.mli | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/curves/bezier.mli b/curves/bezier.mli new file mode 100755 index 0000000..e90163c --- /dev/null +++ b/curves/bezier.mli @@ -0,0 +1,40 @@ +type t = + { p0:Gg.v2 (* The starting point *) + ; p1:Gg.v2 (* The end point *) + ; ctrl0:Gg.v2 (* The control point *) + ; ctrl1:Gg.v2 } (* The control point *) + +type quadratic + +(** + Build a control point for a quadratic curve for passing throuht 3 points. + taken from https://xuhehuan.com/2608.html + + + also look to https://pomax.github.io/bezierinfo/#pointcurves +*) +val three_points_quadratic + : Gg.v2 -> Gg.v2 -> Gg.v2 -> quadratic + +(** + Create a curve from three points. + + This is an implementation for + https://pomax.github.io/bezierinfo/#pointcurves + +*) +val three_points_cubic + : float -> Gg.v2 -> Gg.v2 -> Gg.v2 -> t + +val quadratic_to_cubic + : quadratic -> t + +(** Split a bezier curve in two at a given position *) +val slice + : float -> t -> t * t + +(** Return the closest point to the curve by approximation *) +val get_closest_point + : Gg.v2 -> t -> Gg.v2 + +val reverse: t -> t |