then TANGENT_POINT
else INTERSECTION_POINT
-
let private twointpts (x: float[]) (y: float[]) (a1: float) (b1: float) (phi_1: float) (a2: float) (b2: float) (h2_tr: float) (k2_tr: float) (phi_2: float) (aa: float) (bb: float) (cc: float) (dd: float) (ee: float) (ff: float) =
if abs x.[0] > a1
then x.[0] <- if x.[0] < 0.0 then -a1 else a1
area1 + area2
-
let private threeintpts (xint: float[]) (yint: float[]) (a1: float) (b1: float) (phi_1: float) (a2: float) (b2: float) (h2_tr: float) (k2_tr: float) (phi_2: float) (aa: float) (bb: float) (cc: float) (dd: float) (ee: float) (ff: float) : float =
let mutable tanpts = 0
let mutable tanindex = 0
let theta = Array.zeroCreate 4
- for i in 0..3 do
+ for i in 0 .. 3 do
if abs xint.[i] > a1
then
xint.[i] <- if xint.[i] < 0.0 then -a1 else a1
printf "k=%d: Theta = %f, xint=%f, yint=%f\n" k theta.[k] xint.[k] yint.[k]
#endif
- for j in 1..3 do
+ for j in 1 .. 3 do
let tmp0 = theta.[j]
let tmp1 = xint.[j]
let tmp2 = yint.[j]
area1 + area2 + area3 + area4 + area5
-
let private quadroots (p: float[]) (r: float[,]) =
let mutable b = -p.[1] / (2.0 * p.[0])
let c = p.[2] / p.[0]
for k in 1..3 do
r.[2, k] <- 0.0
-
let private biquadroots (p: float[]) (r: float[,]) =
if p.[0] <> 1.0
then
a <- a - d
let mutable quadExecuted = false
- let quad () =
+ let inline quad () =
if not quadExecuted
then
p.[2] <- c / b
quad ()
// Return a tuple (area, x intersections, y intersections)
-let EEOverlapArea (e1: Types.Ellipse) (e2: Types.Ellipse) : (float * float[] * float[]) option =
- let h1, k1, a1, b1, phi_1 = e1.Cx, e1.Cy, e1.A, e1.B, e1.Alpha
- let h2, k2, a2, b2, phi_2 = e2.Cx, e2.Cy, e2.A, e2.B, e2.Alpha
+let EEOverlapArea (e1: Types.Ellipse) (e2: Types.Ellipse) : (float32 * float32[] * float32[]) option =
+ let h1, k1, a1, b1, phi_1 = float e1.Cx, float e1.Cy, float e1.A, float e1.B, float e1.Alpha
+ let h2, k2, a2, b2, phi_2 = float e2.Cx, float e2.Cy, float e2.A, float e2.B, float e2.Alpha
if a1 <= EPS || b1 <= EPS || a2 <= EPS || b2 <= EPS
then
| 4 -> fourintpts xint yint a1 b1 phi_1 a2 b2 h2_tr k2_tr phi_2 aa bb cc dd ee ff
| _ -> -1.0
if nintpts = 0
- then Some (area, [||], [||])
+ then Some (float32 area, [||], [||])
else
- let xTransform = Array.zeroCreate nintpts
- let yTransform = Array.zeroCreate nintpts
+ let xTransform : float32[] = Array.zeroCreate nintpts
+ let yTransform : float32[] = Array.zeroCreate nintpts
for i in 0 .. (nintpts - 1) do
- xTransform.[i] <- cos phi_1 * xint.[i] - sin phi_1 * yint.[i] + h1
- yTransform.[i] <- sin phi_1 * xint.[i] + cos phi_1 * yint.[i] + k1
- Some (area, xTransform, yTransform)
\ No newline at end of file
+ xTransform.[i] <- float32 <| cos phi_1 * xint.[i] - sin phi_1 * yint.[i] + h1
+ yTransform.[i] <- float32 <| sin phi_1 * xint.[i] + cos phi_1 * yint.[i] + k1
+ Some (float32 area, xTransform, yTransform)
\ No newline at end of file