Jump to content

Problem of Apollonius: Difference between revisions

m
(Added XPL0 example.)
Line 3,596:
proc real AP(C1, C2, C3, S);
real C1, C2, C3; int S;
real X1SQX1sq, Y1SQY1sq, R1SQR1sq,
X2SQX2sq, Y2SQY2sq, R2SQR2sq,
X3SQX3sq, Y3SQY3sq, R3SQR3sq,
V11, V12, V13, V14,
V21, V22, V23, V24,
Line 3,604:
W22, W23, W24,
P, Q, M, N, A, B, C, D, RS;
[
[X1SQ:= C1(X) * C1(X);
Y1SQX1sq:= C1(YX) * C1(YX);
R1SQY1sq:= C1(RY) * C1(RY);
X2SQR1sq:= C2C1(XR) * C2C1(XR);
Y2SQX2sq:= C2(YX) * C2(YX);
R2SQY2sq:= C2(RY) * C2(RY);
X3SQR2sq:= C3C2(XR) * C3C2(XR);
Y3SQX3sq:= C3(YX) * C3(YX);
R3SQY3sq:= C3(RY) * C3(RY);
[X1SQR3sq:= C1C3(XR) * C1C3(XR);
V11:= 2. * (C2(X) - C1(X));
V12:= 2. * (C2(Y) - C1(Y));
V13:= X1SQX1sq - X2SQX2sq + Y1SQY1sq - Y2SQY2sq - R1SQR1sq + R2SQR2sq;
V14:= 2. * (C2(R) - C1(R));
V21:= 2. * (C3(X) - C2(X));
V22:= 2. * (C3(Y) - C2(Y));
V23:= X2SQX2sq - X3SQX3sq + Y2SQY2sq - Y3SQY3sq - R2SQR2sq + R3SQR3sq;
V24:= 2. * (C3(R) - C2(R));
if S then [V14:= -V14; V24:= -V24];
Line 3,629 ⟶ 3,630:
W24:= V24/V21 - W14;
P:= -W23 / W22;
Q:= W24 / W22;
M:= -W12*P - W13;
N:= W14 - W12*Q;
A:= N*N + Q*Q - 1.;
B:= M*N - N*C1(X) + P*Q - Q*C1(Y);
Line 3,637 ⟶ 3,638:
else B:= B + C1(R);
B:= B * 2.;
C:= X1SQX1sq + M*M - 2.*M*C1(X) + P*P + Y1SQY1sq - 2.*P*C1(Y) - R1SQR1sq;
D:= B*B - 4.*A*C;
RS:= (-B - sqrt(D)) / (2.*A);
Line 3,645 ⟶ 3,646:
];
 
real C1, C2, C3;
[
[C1:= [0., 0., 1.];
C2:= [4., 0., 1.];
C3:= [2., 4., 2.];
297

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.