X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemia%2FTypes.fs;h=589a735380c039c2006e285604caa5b746b6c88e;hp=308fc6bcd49ad958e6db53ac267be12b79a98e8c;hb=dec96d50e56e1932bbfa09e6bedf90d6b707ccbd;hpb=ba64921fb9a0c36cd8cf802cbf1b2c0f79bc25f6 diff --git a/Parasitemia/Parasitemia/Types.fs b/Parasitemia/Parasitemia/Types.fs index 308fc6b..589a735 100644 --- a/Parasitemia/Parasitemia/Types.fs +++ b/Parasitemia/Parasitemia/Types.fs @@ -2,7 +2,14 @@ open System -type Ellipse = { cx: float; cy: float; a: float; b: float; alpha: float } - +type Ellipse (cx: float, cy: float, a: float, b: float, alpha: float) = + member this.Cx = cx + member this.Cy = cy + member this.A = a + member this.B = b + member this.Alpha = alpha + member this.Area = a * b * Math.PI -//type PointImg = { x: int; y: int } \ No newline at end of file + // Does the ellipse contain the point (x, y)?. + member this.Contains x y = + ((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 \ No newline at end of file