Finding ellipses and parasites.
[master-thesis.git] / Parasitemia / Parasitemia / Types.fs
1 module Types
2
3 open System
4
5 type Ellipse (cx: float, cy: float, a: float, b: float, alpha: float) =
6 member this.Cx = cx
7 member this.Cy = cy
8 member this.A = a
9 member this.B = b
10 member this.Alpha = alpha
11 member this.Area = a * b * Math.PI
12
13 // Does the ellipse contain the point (x, y)?.
14 member this.Contains x y =
15 ((x - cx) * cos alpha + (y - cy) * sin alpha) ** 2.0 / a ** 2.0 + ((x - cx) * sin alpha - (y - cy) * cos alpha) ** 2.0 / b ** 2.0 <= 1.0