链接: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. python时间处理函数

    所有日期.时间的api都在datetime模块内. 1. 日期输出格式化 datetime => string import datetime now = datetime.datetime.n ...

  2. 图书管理之HTML5压缩旋转裁剪图片总结

    整体思路  : 在移动端压缩图片并且上传主要用到filereader.canvas 以及 formdata 这三个h5的api.逻辑并不难.整个过程就是: (1)用户使用input file上传图片的 ...

  3. 161116、springmvc自己实现防止表单重复提交(基于注解)

    原理:在去某个页面直接生成一个随机数(这里使用的是UUID)并放入session中,用户提交表单时将这个随机数传入服务端与session中的值进行比较,如果不不存在或不相等,则认为是重复提交:如果相等 ...

  4. TI CC2541的GPIO引脚设置.

    P1SEL寄存器, 0xF4, 功能选择用的, 0表示GPIO口, 1表示外设.

  5. 安装LAMP

    1.首先打开命令行,获得最新的软件包 sudo apt-get install update 2.安装MySQL数据库 sudo apt-get install mysql-server mysql- ...

  6. [转]Jexus的常用操作和基本配置

    转自http://www.cnblogs.com/xiaodiejinghong/archive/2013/04/05/3000404.html 3.Jexus的操作 经过两个章节关于Jexus的介绍 ...

  7. 时间戳转换成Date

    SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); String date = for ...

  8. php中urlencode与rawurlencode的区别有那些呢

    urlencode 函数: 返回字符串,此字符串中除了 -_. 之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数,空格则编码为加号(+).此编码与 WWW 表单 POST 数据的编码 ...

  9. C#:使用Hashtable实现输出那些用户发表主题最多的信息

    构思:先计算各自的数量,那些数量最多,输出详细信息 具体算法如下: public class Count { #region 计算各实体数量 public static Hashtable Entit ...

  10. 第一课: iOS入门

    xcode几个项目模板的说明: http://blog.csdn.net/chang6520/article/details/7926444 1. single view app: xcode中的st ...