日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內(nèi)最全I(xiàn)T社區(qū)平臺(tái) 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁 > php開源 > php教程 > POJ 3808 Malfatti Circles(計(jì)算幾何)

POJ 3808 Malfatti Circles(計(jì)算幾何)

來源:程序員人生   發(fā)布時(shí)間:2015-05-19 08:12:53 閱讀次數(shù):2639次
Malfatti Circles
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 250   Accepted: 125   Special Judge

Description

The con?guration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centuries. Existence and uniqueness of such circles for an arbitrary triangle are easy to prove. Many methods of numerical calculation or geometric construction of such circles from an arbitrarily given triangle have been discovered. Today, such circles are called the Malfatti circles. 

Figure 7 illustrates an example. The Malfatti circles of the triangle with the vertices (20, 80), (⑷0, ⑵0) and (120, ⑵0) are approximately 
the circle with the center (24.281677, 45.219486) and the radius 21.565935, 
the circle with the center (3.110950, 4.409005) and the radius 24.409005, and 
the circle with the center (54.556724, 7.107493) and the radius 27.107493. 

Figure 8 illustrates another example. The Malfatti circles of the triangle with the vertices (20, ⑵0), (120, ⑵0) and (⑷0, 80) are approximately 
the circle with the center (25.629089, ⑴0.057956) and the radius 9.942044, 
the circle with the center (53.225883, -0.849435) and the radius 19.150565, and 
the circle with the center (19.701191, 19.203466) and the radius 19.913790. 

Your mission is to write a program to calculate the radii of the Malfatti circles of the given triangles. 

Input

The input is a sequence of datasets. A dataset is a line containing six integers x1, y1, x2, y2, x3 and y3 in this order, separated by a space. The coordinates of the vertices of the given triangle are (x1, y1), (x2, y2) and (x3, y3), respectively. You can assume that the vertices form a triangle counterclockwise. You can also assume that the following two conditions hold. 

All of the coordinate values are greater than ⑴000 and less than 1000. 
None of the Malfatti circles of the triangle has a radius less than 0.1. 

The end of the input is indicated by a line containing six zeros separated by a space.

Output

For each input dataset, three decimal fractions r1, r2 and r3 should be printed in a line in this order separated by a space. The radii of the Malfatti circles nearest to the vertices with the coordinates (x1, y1), (x2, y2) and (x3, y3) should be r1, r2 and r3, respectively. 

None of the output values may have an error greater than 0.0001. No extra character should appear in the output.

Sample Input

20 80 ⑷0 ⑵0 120 ⑵0 20 ⑵0 120 ⑵0 ⑷0 80 0 0 1 0 0 1 0 0 999 1 ⑼99 1 897 ⑼16 847 ⑼72 890 ⑼25 999 999 ⑼99 ⑼98 ⑼98 ⑼99 ⑼99 ⑼99 999 ⑼99 0 731 ⑼99 ⑼99 999 ⑷64 ⑷64 999 979 ⑷36 ⑼55 ⑶37 157 ⑷39 0 0 0 0 0 0

Sample Output

21.565935 24.409005 27.107493 9.942044 19.150565 19.913790 0.148847 0.207107 0.207107 0.125125 0.499750 0.499750 0.373458 0.383897 0.100456 0.706768 0.353509 0.353509 365.638023 365.638023 365.601038 378.524085 378.605339 378.605339 21.895803 22.052921 5.895714


題意:給出1個(gè)3角形的3個(gè)頂點(diǎn)的坐標(biāo),求3角形的3個(gè)內(nèi)切圓,它們兩兩相切,并且每一個(gè)頂點(diǎn)附近的圓和連接這個(gè)頂點(diǎn)的兩條邊也相切。求著3個(gè)內(nèi)切圓的半徑。

分析:套公式。

其中r為3角形內(nèi)切圓的半徑,s為半周長。

#include <cstdio> #include <cmath> using namespace std; struct Point { double x, y; } A, B, C, I; double get_dis(Point p1, Point p2) { return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)); } int main() { while(~scanf("%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y)) { if(A.x == 0 && A.y == 0 && B.x == 0 && B.y == 0 && C.x == 0 && C.y == 0) break; double a = get_dis(B, C); double b = get_dis(A, C); double c = get_dis(A, B); double s = (a + b + c) / 2; // 半周長 I.x = (a * A.x + b * B.x + c * C.x) / (a + b + c); I.y = (a * A.y + b * B.y + c * C.y) / (a + b + c); // 內(nèi)切圓圓心坐標(biāo) double r = sqrt((s - a) * (s - b) * (s - c) / s); // 內(nèi)切圓半徑 double IA = get_dis(A, I); double IB = get_dis(B, I); double IC = get_dis(C, I); double r1 = r / (2 * (s - a)) * (s - r + IA - IB - IC); double r2 = r / (2 * (s - b)) * (s - r + IB - IA - IC); double r3 = r / (2 * (s - c)) * (s - r + IC - IA - IB); printf("%.6lf %.6lf %.6lf ", r1, r2, r3); } return 0; }


更多解釋請見http://en.wikipedia.org/wiki/Malfatti_circles

生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 91年国产在线 | 亚洲国内精品 | 精品久久一区 | 日韩一级欧美 | 九九综合九九 | 在线影视 | 日本成人一区 | 精品美女| 亚洲成人1区| 日韩午夜高清 | 少妇精品视频一区二区免费看 | 91久久国产综合久久91猫猫 | 麻豆成人久久精品二区三区小说 | 久久久国产精品视频 | 免费国产福利 | 老熟妇午夜毛片一区二区三区 | 亚洲午夜在线观看 | 欧美日韩中文在线观看 | 欧美区在线 | 国产精品高清一区 | 国产毛片一区二区三区 | 九九九九精品九九九九 | 精品日韩视频 | 一区二区国产精品视频 | 成人av.com| 欧美亚洲视频 | 欧美日色 | 美女精品一区 | 亚洲精品麻豆 | 午夜欧美一区二区三区在线播放 | 欧美一级黄色免费电影 | 成人欧美一区二区三区黑人孕妇 | 国产又黄又爽又色在线视频播放 | 黄色精品一区 | 日本网站免费观看 | 国产黄色在线 | 久久精品一区二区三区不卡牛牛 | 欧美在线性爱视频 | 欧美视频二区 | 国产精品视频网 | 成人免费福利 |