diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-01-07 21:54:46 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-01-09 06:27:18 +0100 |
commit | 32618a5ce8e2b306af102e4c16711b090c36b840 (patch) | |
tree | 1c22b5bcf9f29e9ff0118cfa9aedd6fb05c9ab0f /path/builder.ml | |
parent | 6e5c6bf7beadc72e64e5d929e301b473b01c9303 (diff) |
Allow point movement
Diffstat (limited to 'path/builder.ml')
-rwxr-xr-x | path/builder.ml | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/path/builder.ml b/path/builder.ml index 182fc13..fd772ea 100755 --- a/path/builder.ml +++ b/path/builder.ml @@ -119,24 +119,29 @@ module Make(Point:P) = struct |> Repr.line_to p1 p2 in ( path ) | p0::p1::p2::[] -> - let path = Repr.start p0 path in - let b = Shapes.Bezier.quadratic_to_cubic + let b0, b1 = Shapes.Bezier.quadratic_to_cubic @@ Shapes.Bezier.three_points_quadratic (Point.get_coord p0) (Point.get_coord p1) (Point.get_coord p2) + |> Shapes.Bezier.slice 0.5 in - - let p0' = Point.copy p0 b.Shapes.Bezier.p0 - and p2' = Point.copy p1 b.Shapes.Bezier.p1 in - - ( Repr.quadratic_to - p0' - b.Shapes.Bezier.ctrl0 - b.Shapes.Bezier.ctrl1 - p2' - path ) + let p0' = Point.copy p0 b0.Shapes.Bezier.p0 + and p1' = Point.copy p1 b0.Shapes.Bezier.p1 + and p2' = Point.copy p2 b1.Shapes.Bezier.p1 in + + Repr.start p0 path + |> Repr.quadratic_to + p0' + b0.Shapes.Bezier.ctrl0 + b0.Shapes.Bezier.ctrl1 + p1' + |> Repr.quadratic_to + p1' + b1.Shapes.Bezier.ctrl0 + b1.Shapes.Bezier.ctrl1 + p2' | (p0::_ as points) -> let (let*) v f = |