From 561d0f0155f4906d90eb7e73a3ff9cb28909126f Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 5 Feb 2021 09:08:39 +0100 Subject: Update project structure --- script.it/path/fixed.mli | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 script.it/path/fixed.mli (limited to 'script.it/path/fixed.mli') diff --git a/script.it/path/fixed.mli b/script.it/path/fixed.mli new file mode 100755 index 0000000..111187c --- /dev/null +++ b/script.it/path/fixed.mli @@ -0,0 +1,81 @@ +(** Signature for points *) +module type P = sig + type t + + val get_coord : t -> Gg.v2 + + val id : t -> int + + val copy : t -> Gg.v2 -> t + +end + +module Make(Point:P) : sig + + module type BUILDER = sig + type t + + val repr + : t -> (module Repr.M with type point = Point.t and type t = 's) -> 's -> 's + + end + + type t + + (** Create a path from a builder *) + val to_fixed + : (module BUILDER with type t = 'a) -> 'a -> t + + (** Represent the path *) + val repr + : t -> (module Repr.M with type point = Point.t and type t = '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 + ; ratio : float + ; p0 : Point.t + ; p1 : Point.t } + + (** Return the distance between a given point and the curve. May return + None if the point is out of the curve *) + val distance + : Gg.v2 -> t -> approx option + + (** Iterate over a path *) + val iter + : t -> f:(Point.t -> unit) -> unit + + (** 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 option + + (** Replace a point by the given one. + + An existing point with the same id shall be present in the path. + + The path is not fully evaluated, and rebuild shall be runned in order to + get the path completely smooth. + + *) + val replace_point + : t -> Point.t -> t option + +end -- cgit v1.2.3