From af88c8895bba85fe5340b34aafb3dce7650bd01f Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 1 Jan 2021 11:08:38 +0100 Subject: Use first type module instead of functors --- path/fixed.mli | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 path/fixed.mli (limited to 'path/fixed.mli') diff --git a/path/fixed.mli b/path/fixed.mli new file mode 100755 index 0000000..3fc542c --- /dev/null +++ b/path/fixed.mli @@ -0,0 +1,66 @@ +(** Signature for points *) +module type P = sig + type t + + val empty : t + + val get_coord : t -> Gg.v2 + + (** Copy a point and all thoses properties to the given location *) + val copy : t -> Gg.v2 -> t + +end + +module type REPR = sig + type t + + type repr + + (* Start a new path. *) + val start + : t -> repr -> repr + + val line_to + : t -> t -> repr -> repr + + val quadratic_to + : t -> Gg.v2 -> Gg.v2 -> t -> repr -> repr + + val stop + : repr -> repr +end + + +module Make(Point:P) : sig + + module type BUILDER = sig + type t + + val repr + : t -> (module REPR with type t = Point.t and type repr = 's) -> 's -> 's + + end + + type t + + (** Return the identifier for this path *) + val id + : t -> int + + (** 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 with type t = Point.t and type repr = 's) -> 's -> 's + + (** 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 -> (Gg.v2 * float) option + + val map_point + : t -> (Point.t -> Point.t) -> t + +end -- cgit v1.2.3