fn ComDuga Xc1 Yc1 Xc2 Yc2 R1 R2 &X1 &Y1 &X2 &Y2 =
(
DeltaX=CompSub Xc2 Xc1
DeltaY=CompSub Yc2 Yc1
R1_2=CompMul R1 R1
R2_2=CompMul R2 R2
Xc1_2=CompMul Xc1 Xc1
Xc2_2=CompMul Xc2 Xc2
Yc1_2=CompMul Yc1 Yc1
Yc2_2=CompMul Yc2 Yc2
UU=CompSub R1_2 R2_2
UU=CompSub UU Yc1_2
UU=CompSum UU Yc2_2
UU=CompSub UU Xc1_2
UU=CompSum UU Xc2_2
DeltaX_2=CompMul DeltaX DeltaX
DeltaY_2=CompMul DeltaY DeltaY
if (Abs(Xc1.Re-Xc2.Re)>Eps) or (Abs(Xc1.Im-Xc2.Im)>Eps) then
(
Success=CompDiv DeltaY_2 DeltaX_2 &V
U=Complex 1. 0.
A=CompSum V U
Q1=Complex 2. 0.
Q2=CompMul Q1 DeltaY
Success=CompDiv Q2 DeltaX &V1
V1=CompMul V1 Xc1
Q=CompMul UU DeltaY
Success=CompDiv Q DeltaX_2 &V2
Q=Complex 2. 0.
V3=CompMul Q YC1
B=CompSub V1 V2
B=CompSub B V3
Q1=CompMul UU UU
Q2=Complex 4. 0.
Q3=CompMul Q2 DeltaX_2
Success=CompDiv Q1 Q3 &V1
Success=CompDiv UU DeltaX &V2
Q=CompMul V2 Xc1
C=CompSub V1 Q
C=CompSum C XC1_2
C=CompSum C YC1_2
C=CompSub C R1_2
Q1=CompMul B B
Q2=Complex 4. 0.
Q3=CompMul A C
Q4=CompMul Q2 Q3
D=CompSub Q1 Q4
Q1=CompSqrt D
Q2=CompNeg B
Q3=Complex 2. 0.
Q4=CompSum Q2 Q1
Q5=CompMul Q3 A
Success=CompDiv Q4 Q5 &Y1
Q1=CompSqrt D
Q2=CompNeg B
Q3=CompSub Q2 Q1
Q4=Complex 2. 0.
Q5=CompMul Q4 A
Success=CompDiv Q3 Q5 &Y2
Q1=Complex 2. 0.
Q2=CompMul Y1 DeltaY
Q3=CompMul Q1 Q2
V1=CompSub UU Q3
Q1=Complex 2. 0.
Q2=CompMul Q1 DeltaX
Success=CompDiv V1 Q2 &X1
Q1=Complex 2. 0.
Q2=CompMul Y2 DeltaY
Q3=CompMul Q1 Q2
V1=CompSub UU Q3
Q1=Complex 2. 0.
Q2=CompMul Q1 DeltaX
Success=CompDiv V1 Q2 &X2
)
else
if (Abs(Yc1.Re-Yc2.Re)>Eps) or (Abs(Yc1.Im-Yc2.Im)>Eps) then
(
Success=CompDiv DeltaX_2 DeltaY_2 &V
Q1=Complex 1. 0.
A=CompSum V Q1
Success=CompDiv(CompMul((Complex 2. 0.) DeltaX) DeltaY &V1)
V1=CompMul(V1 Yc1)
Success= CompDiv(CompMul(UU DeltaX) DeltaY_2 &V2)
V3=CompMul((Complex 2. 0.) XC1)
B=CompSub(V1 V2)
B=CompSub(B V3)
Success=CompDiv(CompMul(UU UU) CompMul((Complex 4. 0.) DeltaY_2) &V1)
Success=CompDiv(UU DeltaY &V2)
C=CompSub(V1 CompMul(V2 Yc1))
C=CompSum(C YC1_2)
C=CompSum(C XC1_2)
C=CompSub(C R1_2)
D=CompSub(CompMul(B B) CompMul((Complex 4. 0.) CompMul(A C)))
Q1=CompSqrt D
Q2=CompNeg B
Q3=Complex 2. 0.
Q4=CompSum Q2 Q1
Q5=CompMul Q3 A
Success=CompDiv Q4 Q5 &X1
Q1=CompSqrt D
Q2=CompNeg B
Q3=CompSub Q2 Q1
Q4=Complex 2. 0.
Q5=CompMul Q4 A
Success=CompDiv Q3 Q5 &X2
V1=CompSub(UU CompMul(Complex(2. 0.) CompMul(X1
DeltaX)))
Success=CompDiv(V1 CompMul(Complex(2. 0.) DeltaY) &Y1)
V1=CompSub(UU CompMul(Complex(2. 0.) CompMul(X2
DeltaX)))
Success=CompDiv(V1 CompMul(Complex(2. 0.) DeltaY) &Y2)
)
Return true
) -- ComDuga |