aboutsummaryrefslogtreecommitdiff
path: root/path/fixed.mli
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-01-07 21:54:46 +0100
committerSébastien Dailly <sebastien@chimrod.com>2021-01-09 06:27:18 +0100
commit32618a5ce8e2b306af102e4c16711b090c36b840 (patch)
tree1c22b5bcf9f29e9ff0118cfa9aedd6fb05c9ab0f /path/fixed.mli
parent6e5c6bf7beadc72e64e5d929e301b473b01c9303 (diff)
Allow point movement
Diffstat (limited to 'path/fixed.mli')
-rwxr-xr-xpath/fixed.mli39
1 files changed, 27 insertions, 12 deletions
diff --git a/path/fixed.mli b/path/fixed.mli
index 06b3539..2daadb4 100755
--- a/path/fixed.mli
+++ b/path/fixed.mli
@@ -6,6 +6,8 @@ module type P = sig
val id : t -> int
+ val copy : t -> Gg.v2 -> t
+
end
module Make(Point:P) : sig
@@ -32,6 +34,8 @@ module Make(Point:P) : sig
val repr
: t -> (module Repr.M with type t = Point.t and type repr = 's) -> 's -> 's
+ (** Structure to represent all the required information for evaluating the
+ distance between a point and a path *)
type approx =
{ distance : float
; closest_point : Gg.v2
@@ -44,27 +48,38 @@ module Make(Point:P) : sig
val distance
: Gg.v2 -> t -> approx option
+ (** Iterate over a path *)
val iter
: t -> f:(Point.t -> unit) -> unit
- val map_point
+ (** Map all the points in the path *)
+ val map
: t -> (Point.t -> Point.t) -> t
+ (** Reevaluate all the control points on the path in order to get a smooth
+ curve *)
+ val rebuild
+ : t -> t option
+
+ (** Delete a point in the path.
+
+ Reconnect the path without the point removed, and reevaluate all the
+ control points from the nodes
+
+ return None if the point is not present in the curve
+ *)
val remove_point
- : t -> Point.t -> t
+ : t -> Point.t -> t option
- type bezier =
- { p0:Point.t (* The starting point *)
- ; p1:Point.t (* The end point *)
- ; ctrl0:Gg.v2 (* The control point *)
- ; ctrl1:Gg.v2 } (* The control point *)
+ (** Replace a point by the given one.
- type path =
- | Line of Point.t * Point.t
- | Curve of bezier
+ An existing point with the same id shall be present in the path.
- val path : t -> path array
+ The path is not fully evaluated, and rebuild shall be runned in order to
+ get the path completely smooth.
- val update : t -> path array -> t
+ *)
+ val replace_point
+ : t -> Point.t -> t option
end