首页 > 其他 > 详细

求两个圆的公切线

时间:2016-11-24 14:30:23      阅读:268      评论:0      收藏:0      [点我收藏+]
Manipulate[
Block[{deta1, deta2, p1, p2, q, a1, b1, a2, b2, outerLine1, 
   outerLine2, innerLine1, innerLine2},
  {{a1, b1}, {a2, b2}} = p;
  deta1 = (a1 - a2)^2 + (b1 - b2)^2 - (r1 + r2)^2;
  deta2 = (a1 - a2)^2 + (b1 - b2)^2 - (r1 - r2)^2;
  p1 = r1 (a2^2 + b2^2 - a1 a2 - b1 b2);
  p2 = r2 (a1^2 + b1^2 - a1 a2 - b1 b2);
  q = a1 b2 - a2 b1;
  innerLine1 = ((a2 - a1) (r1 + r2) + (b1 - b2) Sqrt[
         deta1]) x + ((b2 - b1) (r1 + r2) + (a2 - a1) Sqrt[deta1]) y -
      p1 + p2 + q Sqrt[deta1] == 0;
  innerLine2 = ((a2 - a1) (r1 + r2) - (b1 - b2) Sqrt[
         deta1]) x + ((b2 - b1) (r1 + r2) - (a2 - a1) Sqrt[deta1]) y -
      p1 + p2 - q Sqrt[deta1] == 0;
  outerLine1 = ((a2 - a1) (r1 - r2) + (b1 - b2) Sqrt[
         deta2]) x + ((b2 - b1) (r1 - r2) + (a2 - a1) Sqrt[deta2]) y -
      p1 - p2 + q Sqrt[deta2] == 0;
  outerLine2 = ((a2 - a1) (r1 - r2) - (b1 - b2) Sqrt[
         deta2]) x + ((b2 - b1) (r1 - r2) - (a2 - a1) Sqrt[deta2]) y -
      p1 - p2 - q Sqrt[deta2] == 0;
  Show[Graphics[{Circle[{a1, b1}, r1], Circle[{a2, b2}, r2]},  PlotRange -> 6, Frame -> 1], 
   ContourPlot[ Evaluate@{outerLine1, outerLine2, innerLine1, innerLine2}, {x, -5,5}, {y, -5, 5}]]
  ], {{p, {{-3, 1}, {3, 0}}}, Locator}, {{r1, 1}, 1, 3}, {{r2, 2}, 1, 
  3}]

 

求两个圆的公切线

原文:http://www.cnblogs.com/lxdonge/p/6097128.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!