From a8f37f041dce3f16917b6659d3ca97492f178f4d Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 3 Jan 2021 05:42:35 +0100 Subject: Communication with webworker --- shapes/bezier.ml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'shapes') diff --git a/shapes/bezier.ml b/shapes/bezier.ml index bf7aaaa..f5f288c 100755 --- a/shapes/bezier.ml +++ b/shapes/bezier.ml @@ -201,3 +201,28 @@ let reverse ; p1 = bezier.p0 ; ctrl0 = bezier.ctrl1 ; ctrl1 = bezier.ctrl0 } + +(** + + see https://github.com/Pomax/BezierInfo-2/blob/master/docs/js/graphics-element/lib/bezierjs/bezier.js#L504 + + let root + : t -> 'a + = fun bezier -> + + let accept + : float -> bool + = fun t -> + 0. <= t && t <= 1. in + + let cuberoot v = + if v < 0. then + Float.pow (Float.neg v) ( 1. /. 3.) + |> Float.neg + else Float.pow v (1. /. 3.) in + + + + + failwith "Non implemented" +*) -- cgit v1.2.3