Cleaning.
[master-thesis.git] / Parasitemia / Parasitemia / Types.fs
index d7bacbd..e27f7d0 100644 (file)
@@ -30,6 +30,16 @@ type Ellipse (cx: float, cy: float, a: float, b: float, alpha: float) =
         this.CutAVericalLine 0.0 || this.CutAVericalLine width ||
         this.CutAnHorizontalLine 0.0 || this.CutAnHorizontalLine height
 
+    member this.Scale (factor: float) =
+        Ellipse(this.Cx, this.Cy, this.A * factor, this.B * factor, alpha)
+
+    // Approximation of Ramanujan.
+    member this.Perimeter =
+        Math.PI * (3.0 * (this.A + this.B) - sqrt ((3.0 * this.A + this.B) * (this.A + 3.0 * this.B)))
+
+    override this.ToString () =
+        sprintf "(cx: %A, cy: %A, a: %A, b: %A, alpha: %A)" this.Cx this.Cy this.A this.B this.Alpha
+
 
 type CellClass = HealthyRBC | InfectedRBC | Peculiar
 
@@ -42,6 +52,7 @@ type Cell = {
 type Line (a: float, b: float) =
     member this.A = a
     member this.B = b
+    member this.Valid = not (Double.IsInfinity this.A)
 
 [<Struct>]
 type PointD (x: float, y: float) =