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