aboutsummaryrefslogtreecommitdiff
path: root/path/point.ml
diff options
context:
space:
mode:
Diffstat (limited to 'path/point.ml')
-rwxr-xr-xpath/point.ml18
1 files changed, 16 insertions, 2 deletions
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