aboutsummaryrefslogtreecommitdiff
path: root/path/fixed.mli
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-01-01 11:08:38 +0100
committerSébastien Dailly <sebastien@chimrod.com>2021-01-01 11:08:38 +0100
commitaf88c8895bba85fe5340b34aafb3dce7650bd01f (patch)
treeee0c9d1bd463242c681c6202a9a57c8110d58f59 /path/fixed.mli
parente25b7797708c19cbaef68c14ebef8738de44c2d9 (diff)
Use first type module instead of functors
Diffstat (limited to 'path/fixed.mli')
-rwxr-xr-xpath/fixed.mli66
1 files changed, 66 insertions, 0 deletions
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