链接: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. QTP常用功能

    1.QTP录制过程的截图 查看录制脚本过程中QTP的截图可以在QTP中查找,在关键字视图中点击每一步都对应一个截图   2.在关键字视图中为测试步骤添加注释 在关键字视图中表格列头中单击鼠标右键,选择 ...

  2. javax.transaction.xa.XAException: java.sql.SQLException: 无法创建 XA 控制连接。(SQL 2000,SQL2005,SQL2008)

    javax.transaction.xa.XAException: java.sql.SQLException:无法创建 XA 控制连接.错误: 未能找到存储过程'master..xp_sqljdbc ...

  3. source insight技巧

    (1)在Source Insight中能不能设置永久Bookmark 可以从macro方面入手 (2)source insight中添加.S文件 (3)source insight里面怎么能不让它每次 ...

  4. 连接ssh反应很慢,卡,延迟

    1.关闭DNS反向解析在linux中,默认就是开启了SSH的反向DNS解析,这个会消耗大量时间,因此需要关闭.# vi /etc/ssh/sshd_configUseDNS=no 在配置文件中,虽然U ...

  5. FTP上传类

    using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;usi ...

  6. oracle日期函数2!

    1.日期时间间隔操作  当前时间减去7分钟的时间 select sysdate,sysdate - interval '7' MINUTE from dual 当前时间减去7小时的时间 ...

  7. 通过SQL Server Profiler来监视分析死锁

    在两个或多个SQL Server进程中,每一个进程锁定了其他进程试图锁定的资源,就会出现死锁,例如,进程process1对table1持有1个排它锁(X),同时process1对table2请求1个排 ...

  8. 检测内存泄露:Instruments中的Leaks

    前言 如果要检测内存泄露,我们会使用Xcode7自带的Instruments中的Leaks工具来检测. 现在的开发环境是ARC,所以很少会出现内存泄漏的情况. 不过我们一定要养好码代码的规范性. 例如 ...

  9. php number_format()保留小数点后几位

    [PHP_保留两位小数的相关函数] php保留两位小数并且四舍五入 Php代码   1     $num = 123213.666666;  2     echo sprintf("%.2f ...

  10. Jquery知识

    1.窗口自适应调整 (设置layout的fit属性值为true即可) //窗口自适应调整 $(function() { windowResize(); //文档载入时加载 $(window).resi ...