链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=199

Point of Intersection


Time Limit: 2 Seconds      Memory Limit: 65536 KB

Given two circles on the same plane which are centered at (x1,y1) and (x2,y2) ,with radiuses r1 and r2, respectively.We can see that they have two common tangent lines in most of the cases.Now you are asked to write a programme to calculate the point of intersection of the two tangents if there exists one. ( See Figure 1 )

Figure. 1 Point of intersection

Input

The input data consists of the information of several figures.The first line of the input contains the number of figures. 
Each figure is described by two lines of data.Each line contains 3 integers constituting the coordinates of the center (x, y) and the radius r (>0) of a circle.

Output

For each figure, you are supposed to output the coordinates (x, y) of the point of intersection if it exists.The x and y must be rounded to two decimal places and be separated by one space.If there is no such point exists simply output "Impossible."

Sample Input

2
0 0 10
0 0 5
0 0 10
10 0 1

Output for the Sample Input

Impossible.
11.11 0.00

Notice

The common tangent lines like the following figure don't take into account;


Source: Zhejiang University Local Contest 2002, Preliminary

 

————————————————————————————————————————————————————

题意很明确,就是求两圆公切线的交点

要判断什么情况下无法画公切线,其实也就是内含,与内切不行

然后推导公式,X=r2/(r1-r2)*(x2-x1)+x2;

                          Y=r2/(r1-r2)*(y2-y1)+y2;

如果你说,这怎么推?俺不会

那我可以说你就是个脑残

因为我也推不出来,找到这里才了解:

http://zhidao.baidu.com/link?url=FSE5MMeIMP8OOOEe4sSqLTZHEVLAQDd4j5gKkIZo54kMCd6TfwWFs3nOame8It1FuGpmVFdFbK3pbyhydbRco_

是不是脑残?中学数学都不会,丢不丢人?

楼主就是个脑残模板,就这公式推了一天

这模板希望永远别使用

——————————————————————————————————————————————————————

 #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream> using namespace std; #define eps 1e-8 typedef struct point
{
double x;
double y;
}point; double dy(double x,double y){ return x>y+eps; }
double xy(double x,double y){ return x<y-eps; }
double dyd(double x,double y){ return x>y-eps; }
double xyd(double x,double y){ return x<y+eps; }
double dd(double x,double y){ return fabs(x-y)<eps; } double dist(point a,point b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));//virtual
} int main()
{
int t;
point o1,o2;
double r1,r2;
scanf("%d",&t);
while(t--)
{
double x1,x2,y1,y2,r3,r4;
scanf("%lf%lf%lf",&x1,&y1,&r3);
scanf("%lf%lf%lf",&x2,&y2,&r4);
if(dy(r3,r4))
{
o1.x=x1;o2.x=x2;
o1.y=y1;o2.y=y2;
r1=r3; r2=r4;
}
else
{
o1.x=x2;o2.x=x1;
o1.y=y2;o2.y=y1;
r1=r4; r2=r3;
}
if(dd(r1,r2) || xyd(dist(o1,o2)+r2,r1))
printf("Impossible.\n");
else
{
double x=(r2/(r1-r2))*(o2.x-o1.x)+o2.x;
double y=(r2/(r1-r2))*(o2.y-o1.y)+o2.y;
printf("%.2lf %.2lf\n",x,y);
}
}
return ;
}

zoj 1199 几何公式推导的更多相关文章

  1. ZOJ 3903 Ant(公式推导)

    这个公式推导过程是看的这位大牛的http://blog.csdn.net/bigbigship/article/details/49123643 扩展欧几里德求模的逆元方法: #include < ...

  2. 多视几何——三角化求解3D空间点坐标

    VINS-Mono / VINS-Fusion中triangulatePoint()函数通过三角化求解空间点坐标,代码所体现的数学描述不是很直观,查找资料,发现参考文献[1]对这个问题进行详细解释,记 ...

  3. SVM个人学习总结

    SVM个人学习总结 如题,本文是对SVM学习总结,主要目的是梳理SVM推导过程,以及记录一些个人理解. 1.主要参考资料 [1]Corres C. Support vector networks[J] ...

  4. ZOJ 2301/HDU 1199 线段树+离散化

    给这个题目跪了两天了,想吐简直 发现自己离散化没学好 包括前一个离散化的题目,实际上是错了,我看了sha崽的博客后才知道,POJ那题简直数据弱爆了,本来随便一组就能让我WA掉的,原因在于离散化的时候, ...

  5. [ACM_暴力][ACM_几何] ZOJ 1426 Counting Rectangles (水平竖直线段组成的矩形个数,暴力)

    Description We are given a figure consisting of only horizontal and vertical line segments. Our goal ...

  6. [ACM_几何] Transmitters (zoj 1041 ,可旋转半圆内的最多点)

    Description In a wireless network with multiple transmitters sending on the same frequencies, it is ...

  7. ZOJ 2301 / HDU 1199 Color the Ball 离散化+线段树区间连续最大和

    题意:给你n个球排成一行,初始都为黑色,现在给一些操作(L,R,color),给[L,R]区间内的求染上颜色color,'w'为白,'b'为黑.问最后最长的白色区间的起点和终点的位置. 解法:先离散化 ...

  8. 简单几何(直线与圆的交点) ZOJ Collision 3728

    题目传送门 题意:有两个一大一小的同心圆,圆心在原点,大圆外有一小圆,其圆心有一个速度(vx, vy),如果碰到了小圆会反弹,问该圆在大圆内运动的时间 分析:将圆外的小圆看成一个点,判断该直线与同心圆 ...

  9. HDU 1199 &amp;&amp; ZOJ 2301 线段树离散化

    一段长度未知的线段.一种操作:a b c ,表示区间[a,b]涂为颜色C,w代表白色,b代表黑色,问终于的最长连续白色段,输出起始位置和终止位置 离散化处理.和寻常的离散化不同,须要把点化成线段.左闭 ...

随机推荐

  1. HorizontalScrollView水平滑动

    xml布局 <HorizontalScrollView            android:id="@+id/hsv"            android:layout_ ...

  2. android 项目学习随笔十五(ShareSDK开放平台)

    ShareSDK开放平台http://www.mob.com/#/

  3. TI CC2541的狗日的Key

    被突如其来的一个bug困扰了好几天, 起因是, 按键接的红外接收器, 结果发现, 一旦按下之后, IEN1, P0IE的标识位bit5, 被不知道特么的谁归0了, 也就是说, 按键只能被按下一次, 再 ...

  4. Perl 和 Python 的比较 【转】

    转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&id=4662991&uid=608135 作为万年Perl 党表示最近开 ...

  5. JavaEE基础(十八)/集合

    1.集合框架(Map集合概述和特点) A:Map接口概述 查看API可以知道: 将键映射到值的对象 一个映射不能包含重复的键 每个键最多只能映射到一个值 B:Map接口和Collection接口的不同 ...

  6. java 字符串处理

    第一张: 第二张:

  7. bootstrap 列表 表格 表单 复选 单选 多选 输入框组

    一.列表 ul li 二.表格 table  (http://www.runoob.com/bootstrap/bootstrap-tables.html) 1. 基本表格 <table cla ...

  8. sharepint 数据视图 添加超链接

    1. 数值域清除数值,输入文本 详细进度 2. 添加连接 到 哪个页面 3. 将inteid拖过来 4. 连接到项目显示表单 5. 直接改下面的连接地址 <a href="http:/ ...

  9. Who's in the Middle 分类: POJ 2015-06-12 19:45 11人阅读 评论(0) 收藏

    Who's in the Middle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 34155   Accepted: 1 ...

  10. UVa 489,紫书P79,刽子手游戏

    题目链接:https://uva.onlinejudge.org/external/4/489.pdf 这个题很像之前的一个拓扑排序的题目,思路类似咯. 程序模块化: 每次判断一个字母,lose,wi ...