From 21c386fee208adb7b494d2677d9f49ed49a1c1ce Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 7 Jan 2021 14:20:54 +0100 Subject: Local point configuration --- path/point.ml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'path/point.ml') diff --git a/path/point.ml b/path/point.ml index d49d655..4c34899 100755 --- a/path/point.ml +++ b/path/point.ml @@ -1,8 +1,11 @@ +let internal_id = ref 0 + type t = { p: Gg.v2 ; size : float ; angle: float ; stamp : float + ; id : int } let empty = @@ -10,17 +13,23 @@ let empty = ; size = 0. ; angle = 0. ; stamp = 0. + ; id = 0 } let create ~angle ~width ~stamp ~x ~y = + + incr internal_id; { p = Gg.V2.v x y ; size = width ; angle = Gg.Float.rad_of_deg (180. -. angle ) ; stamp + ; id = !internal_id } let copy point p = - { point with p } + { point with + p + } let set_angle p angle = { p with angle = Gg.Float.rad_of_deg (180. -. angle) } @@ -49,6 +58,7 @@ let get_coord' let mix : float -> Gg.v2 -> t -> t -> t = fun f point p0 p1 -> + incr internal_id; let angle0 = p0.angle and angle1 = p1.angle and width0 = get_width p0 @@ -61,4 +71,8 @@ let mix { p = point ; size = width ; angle - ; stamp } + ; stamp + ; id = !internal_id + } + +let id { id; _} = id -- cgit v1.2.3