Add a logger assembly and split the main assembly in two : the UI and the parasitemia...
[master-thesis.git] / Parasitemia / Parasitemia / Utils.fs
diff --git a/Parasitemia/Parasitemia/Utils.fs b/Parasitemia/Parasitemia/Utils.fs
deleted file mode 100644 (file)
index 638f9f5..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-module Utils
-
-open System.Diagnostics
-
-open Types
-
-let inline roundInt v = v |> round |> int
-
-let inline dprintfn fmt =
-    Printf.ksprintf System.Diagnostics.Debug.WriteLine fmt
-
-let mutable log : (string -> unit) =
-    fun m -> ()
-
-let logTime (m: string) (f: unit -> 'a) : 'a =
-    let sw = Stopwatch()
-    sw.Start()
-    let res = f ()
-    sw.Stop()
-    log <| sprintf "%s (time: %d ms)" m sw.ElapsedMilliseconds
-    res
-
-let inline lineFromTwoPoints (p1: PointD) (p2: PointD) : Line =
-    let a = (p1.Y - p2.Y) / (p1.X - p2.X)
-    let b = -(p2.X * p1.Y - p1.X * p2.Y) / (p1.X - p2.X)
-    Line(a, b)
-
-let inline pointFromTwoLines (l1: Line) (l2: Line) : PointD =
-    let x = -(l1.B - l2.B) / (l1.A - l2.A)
-    let y = -(l2.A * l1.B - l1.A * l2.B) / (l1.A - l2.A)
-    PointD(x, y)
-
-let inline linePassThroughSegment (l: Line) (p1: PointD) (p2: PointD) : bool =
-    let p = pointFromTwoLines l (lineFromTwoPoints p1 p2)
-    sign (p.X - p1.X) <> sign (p.X - p2.X)
-
-let inline squaredDistanceTwoPoints (p1: PointD) (p2: PointD) =
-    (p1.X - p2.X) ** 2.f + (p1.Y - p2.Y) ** 2.f
-
-let inline distanceTwoPoints (p1: PointD) (p2: PointD) =
-    squaredDistanceTwoPoints p1 p2 |> sqrt
-
-let countCells (cells: Cell list) : int * int =
-    cells |> List.fold (fun (total, infected) { cellClass = cellClass } ->
-        match cellClass with
-        | HealthyRBC -> (total + 1, infected)
-        | InfectedRBC -> (total + 1, infected + 1)
-        | Peculiar -> (total, infected)) (0, 0)
\ No newline at end of file