Hi Ed,
Thx for help
> Adam Majewski wrote:
>
>>eq12: (x1-x2)^2 + (y1 -y2)^2 - (r1-r2)^2;
>
> I think you mean (r1+r2)^2 here and in the other two equations.
I have used informations :
"If the center of the second circle is outside the first,
then the - sign corresponds to externally tangent circles
and the + sign to internally tangent circles. "
from :
http://mathworld.wolfram.com/TangentCircles.html
Do I have misunderstood it or is it a bug ?
>In fact, you don't really need eq12.
OK it works good.
Thx
Adam
======== code =================================================
/* computes circles mutually tangent to 2 other circles */
/* gives a list which is used by plot2d for drawing circle */
plot_circle(c,r):=[parametric, realpart(c)+r*cos(t), imagpart(c)+r*sin(t)];
eq13: (x1-x3)^2 + (y1 -y3)^2 - (rad1+rad3)^2;
eq23: (x2-x3)^2 + (y2 -y3)^2 - (rad2+rad3)^2;
eq23: expand(eq23);
eq13: expand(eq13);
rad1:50;
x1:-rad1;
y1:rad1;
c1:x1+y1*%i;
x2:-x1;
y2:y1;
c2:x2+y2*%i;
rad2:rad1;
rad3:rad1;
b:solve([eq23,eq13],[x3,y3]);
c3a:float(rhs(b[1][1]) +rhs(b[1][2])*%i);
c3b:float(rhs(b[2][1]) +rhs(b[2][2])*%i);
h: rad1*sqrt(3);
_y3: float(y1-h);
/* ------------------- -----------------------------*/
plot_list:[];
plot_list:cons(plot_circle(c1,rad1),plot_list);
plot_list:cons(plot_circle(c2,rad2),plot_list);
plot_list:cons(plot_circle(c3a,rad3),plot_list);
plot_list:cons(plot_circle(c3b,rad3),plot_list);
/* --------------------------- drawing code -----------*/
set_plot_option([plot_format, gnuplot]);
set_plot_option([nticks, 80]);
set_plot_option([t,-%pi,%pi]);
set_plot_option([gnuplot_preamble, "unset key"])$ /* */
plot2d (plot_list)$