projects
/
master-thesis.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Add the analysis window.
[master-thesis.git]
/
Parasitemia
/
Parasitemia
/
Utils.fs
diff --git
a/Parasitemia/Parasitemia/Utils.fs
b/Parasitemia/Parasitemia/Utils.fs
index
d6fa2f0
..
c2440b9
100644
(file)
--- a/
Parasitemia/Parasitemia/Utils.fs
+++ b/
Parasitemia/Parasitemia/Utils.fs
@@
-4,7
+4,7
@@
open System.Diagnostics
open Types
open Types
-let
roundInt = int << round
+let
inline roundInt v = v |> round |> int
let inline dprintfn fmt =
Printf.ksprintf System.Diagnostics.Debug.WriteLine fmt
let inline dprintfn fmt =
Printf.ksprintf System.Diagnostics.Debug.WriteLine fmt
@@
-17,7
+17,7
@@
let logTime (m: string) (f: unit -> 'a) : 'a =
sw.Start()
let res = f ()
sw.Stop()
sw.Start()
let res = f ()
sw.Stop()
- log <| sprintf "%
A (time: %A
ms)" m sw.ElapsedMilliseconds
+ log <| sprintf "%
s (time: %d
ms)" m sw.ElapsedMilliseconds
res
let inline lineFromTwoPoints (p1: PointD) (p2: PointD) : Line =
res
let inline lineFromTwoPoints (p1: PointD) (p2: PointD) : Line =
@@
-30,8
+30,12
@@
let inline pointFromTwoLines (l1: Line) (l2: Line) : PointD =
let y = -(l2.A * l1.B - l1.A * l2.B) / (l1.A - l2.A)
PointD(x, y)
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) =
let inline squaredDistanceTwoPoints (p1: PointD) (p2: PointD) =
- (p1.X - p2.X) ** 2.
0 + (p1.Y - p2.Y) ** 2.0
+ (p1.X - p2.X) ** 2.
f + (p1.Y - p2.Y) ** 2.f
let distanceTwoPoints (p1: PointD) (p2: PointD) =
squaredDistanceTwoPoints p1 p2 |> sqrt
let distanceTwoPoints (p1: PointD) (p2: PointD) =
squaredDistanceTwoPoints p1 p2 |> sqrt