链接: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. linux设备驱动归纳总结(二):模块的相关基础概念【转】

    本文转载自:http://blog.chinaunix.net/uid-25014876-id-59415.html linux设备驱动归纳总结(二):模块的相关基础概念 系统平台:Ubuntu 10 ...

  2. 2.1:你的第一个AngularJS App

    本章,带你体验一个简单的开发流程,将一个静态的使用模拟数据的应用,变成具有AngularJS特性的动态web应用.在6-8章,作者将展示如何创建一个更复杂,更真实的AngularJS应用. 1.准备项 ...

  3. Greenplum的全量恢复之gpdbrestore

    gpdbrestore命令是对gp_restore命令的一个包装,提供了更灵活的选项,比如,使用gpcrondump自动备份的文件来恢复.使用gpdbrestore恢复必须具备: 1. 存在gpcro ...

  4. Oracle Hint 用法

    正确的语法是: select /*+ index(x idx_t) */ * from t x where x.object_id=123 /*+    */ 和注释很像,比注释多了一个“+”,这就是 ...

  5. Lambda表达式 一些基本用法

    带条件的:IQueryable<UserInfo> demo=db.UserInfo.where<UserInfo>(u=>u.ID>2); 取指定列数据:var ...

  6. Pearls

    Pearls Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7980 Accepted: 3966 Description In ...

  7. JAVA基础知识之IO——Java IO体系及常用类

    Java IO体系 个人觉得可以用"字节流操作类和字符流操作类组成了Java IO体系"来高度概括Java IO体系. 借用几张网络图片来说明(图片来自 http://blog.c ...

  8. 网页撤销后ubuntu本地撤销

    git reset --hard <commit_id> 回到上一个commit: 之后再    git reset --hard :

  9. Entity Framework 第四篇 优化SQL查询

    Expression<Func<TEntity, bool>>与Func<TEntity, bool>的异同 public IList<TEntity> ...

  10. WPF中父子窗口的层次关系

    关于子窗体的层级关系总结一下哈,希望能对大家有些帮助 假设有这样两个窗体:RootWindow,SubWindow,在RootWindow中引发某事件而显示SubWindow 1,如果弹出窗体(比如S ...