青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品


Intersecting Lines

Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 4260 Accepted: 2049

Description

We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) intersect in a line because they are on top of one another (i.e. they are the same line), 3) intersect in a point. In this problem you will use your algebraic knowledge to create a program that determines how and where two lines intersect.
Your program will repeatedly read in four points that define two lines in the x-y plane and determine how and where the lines intersect. All numbers required by this problem will be reasonable, say between -1000 and 1000.

Input

The first line contains an integer N between 1 and 10 describing how many pairs of lines are represented. The next N lines will each contain eight integers. These integers represent the coordinates of four points on the plane in the order x1y1x2y2x3y3x4y4. Thus each of these input lines represents two lines on the plane: the line through (x1,y1) and (x2,y2) and the line through (x3,y3) and (x4,y4). The point (x1,y1) is always distinct from (x2,y2). Likewise with (x3,y3) and (x4,y4).

Output

There should be N+2 lines of output. The first line of output should read INTERSECTING LINES OUTPUT. There will then be one line of output for each pair of planar lines represented by a line of input, describing how the lines intersect: none, line, or point. If the intersection is a point then your program should output the x and y coordinates of the point, correct to two decimal places. The final line of output should read "END OF OUTPUT".

Sample Input

5
0 0 4 4 0 4 4 0
5 0 7 6 1 0 2 3
5 0 7 6 3 -6 4 -3
2 0 2 27 1 5 18 5
0 3 4 0 1 2 2 5

Sample Output

INTERSECTING LINES OUTPUT
POINT 2.00 2.00
NONE
LINE
POINT 2.00 5.00
POINT 1.07 2.20
END OF OUTPUT
/*************************************
計(jì)算幾何基礎(chǔ)題,判斷直線相交及求交點(diǎn)
注意斜率不存在的情況
*************************************
*/

#include 
<iostream>
#include 
<cstdio>

int main()
{
    
double x1, y1, x2, y2, x3, y3, x4, y4;
    
int n;
    
double k1, k2;
    
double b1, b2;
    
double i_x, i_y;
    scanf(
"%d"&n);
    std::cout 
<< "INTERSECTING LINES OUTPUT" << std::endl;
    
while( n-- )
    
{
        scanf(
"%lf%lf%lf%lf%lf%lf%lf%lf"&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

        
if( x1 != x2 && x3 != x4 )
        
{
            k1 
= ( y2 - y1 ) / ( x2 - x1 );
            k2 
= ( y4 - y3 ) / ( x4 - x3 );
            b1 
= y1 - k1 * x1;
            b2 
= y3 - k2 * x3;
            
if( k1 == k2 )
            
{
                
if( b1 == b2 )
                    printf(
"LINE\n");
                
else
                    printf(
"NONE\n");
            }

            
else
            
{
                i_x 
= (b2 - b1) / (k1 - k2);
                i_y 
= k1 * i_x + b1;
                printf(
"POINT %.2lf %.2lf\n", i_x, i_y);
            }

        }

        
else if( x1 == x2 && x3 == x4 )
        
{
            
if( x1 == x3 )
            std::cout 
<< "LINE\n";
            
else
            std::cout 
<< "NONE\n";
        }

        
else if( x1 == x2 && x3 != x4 )
        
{
            k2 
= ( y4 - y3 ) / ( x4 - x3 );
            b2 
= y3 - k2 * x3;
            i_x 
= x1;
            i_y 
= k2 * x1 + b2;
            printf(
"POINT %.2lf %.2lf\n", i_x, i_y);
        }

        
else
        
{
            k1 
= ( y2 - y1 ) / ( x2 - x1 );
            b1 
= y1 - k1 * x1;
            i_x 
= x3;
            i_y 
= k1 * x3 + b1;
            printf(
"POINT %.2lf %.2lf\n", i_x, i_y);
        }

    }

    std::cout 
<< "END OF OUTPUT\n";
    
return 0;
}

posted on 2010-10-03 11:03 Vontroy 閱讀(829) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 計(jì)算幾何POJ

只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久久人成影片一区二区三区| 久久久久看片| 亚洲国产经典视频| 亚洲一区二区三区视频播放| 伊人成年综合电影网| 亚洲一区视频在线| 日韩网站在线观看| 牛人盗摄一区二区三区视频| 久久婷婷综合激情| 国产欧美日本在线| 亚洲午夜精品在线| 亚洲欧美成人网| 欧美日韩国产页| 亚洲国产日韩欧美在线动漫| 在线看日韩av| 久久视频这里只有精品| 久久精品国产亚洲一区二区三区| 国产精品久久午夜夜伦鲁鲁| 亚洲调教视频在线观看| 亚洲一区在线免费| 国产精品大片wwwwww| 一区二区三区产品免费精品久久75| 亚洲狼人综合| 欧美激情视频一区二区三区免费| 亚洲二区在线| 欧美激情精品久久久久久黑人 | 国产精品嫩草影院av蜜臀| 午夜精品视频在线| 久久夜色精品国产欧美乱| 夜夜嗨av一区二区三区中文字幕 | 国产精品久久久一区二区| 久久国产欧美精品| 欧美日本高清视频| 久久综合一区二区三区| 欧美日韩一区二区免费视频| 久热精品视频在线| 国产精品社区| 亚洲精品国产欧美| 一区二区三区自拍| 午夜精品久久久久久久99樱桃| 亚洲日韩第九十九页| 久久aⅴ国产紧身牛仔裤| 亚洲一区二区三区精品在线| 久久视频在线视频| 久久精品国产99国产精品澳门| 欧美日韩国产精品自在自线| 欧美成人69| 伊人成人在线| 欧美一区激情视频在线观看| 亚洲欧美视频在线观看视频| 欧美日本一区二区三区| 欧美激情亚洲| 在线高清一区| 久久久久久久高潮| 久久久久国色av免费观看性色| 国产精品区一区二区三区| 亚洲精品一区中文| av成人福利| 欧美日韩第一区日日骚| 亚洲国产精品欧美一二99| 在线看国产日韩| 久久阴道视频| 欧美激情一区在线| 亚洲激情欧美激情| 欧美高清在线精品一区| 亚洲福利国产| 日韩一级欧洲| 欧美日韩高清在线| 一区二区三区精品久久久| 亚洲一区在线看| 国产精品久久久久久久久搜平片| 一区二区三区四区在线| 香蕉乱码成人久久天堂爱免费 | 国产精品色午夜在线观看| 宅男噜噜噜66一区二区 | 一色屋精品视频在线看| 久久精品二区三区| 欧美高清视频www夜色资源网| 亚洲国产日韩精品| 欧美日韩八区| 亚洲欧美bt| 麻豆精品精品国产自在97香蕉| 樱桃视频在线观看一区| 欧美福利视频在线| 亚洲免费激情| 欧美在线在线| 在线不卡亚洲| 欧美日韩一区三区| 欧美在线日韩精品| 能在线观看的日韩av| 一区二区三区免费网站| 国产精品一区二区在线观看网站| 午夜欧美精品| 亚洲国产精品成人综合| 亚洲欧美国产日韩中文字幕| 国产一区二区主播在线| 欧美国产视频在线| 亚洲图片在线| 欧美jjzz| 亚洲免费中文| 亚洲国产99精品国自产| 欧美色图一区二区三区| 久久精品国产亚洲精品| 亚洲精品在线免费观看视频| 久久久久高清| 一二三区精品| 在线成人av.com| 国产精品欧美日韩久久| 免费成人av在线| 欧美一区二区视频97| 亚洲精品在线观看视频| 美国十次成人| 欧美在线黄色| 亚洲一区在线看| 日韩午夜中文字幕| 狠狠色综合日日| 国产精品自在线| 欧美日韩免费一区二区三区视频| 欧美在线播放视频| 亚洲一本大道在线| 亚洲精选在线| 欧美大片在线观看| 久久久国产一区二区| 亚洲一区二区三区午夜| 日韩午夜三级在线| 亚洲高清一区二| 国产一区二区三区高清| 国产精品毛片在线| 国产精品yjizz| 欧美日韩不卡视频| 欧美精品久久久久a| 女同性一区二区三区人了人一 | 亚洲视屏在线播放| 亚洲国产精品第一区二区| 久久这里只有| 久久久久成人精品| 久久精品视频播放| 久久精品成人| 久久激情婷婷| 欧美一区国产在线| 欧美一区二区日韩| 久久国产高清| 久久久久久**毛片大全| 久久久久在线观看| 老司机午夜精品视频| 麻豆av福利av久久av| 欧美大片91| 亚洲黄色一区二区三区| 亚洲国产精品尤物yw在线观看| 免费观看在线综合色| 牛夜精品久久久久久久99黑人| 免费看精品久久片| 亚洲大片精品永久免费| 亚洲激情av在线| 一区二区三区日韩精品| 午夜精品美女自拍福到在线 | 欧美成人网在线| 亚洲高清不卡在线| 亚洲精品久久久久| 亚洲视频免费| 久久精品一区二区三区不卡牛牛| 久久精品免费观看| 欧美黄色成人网| 欧美午夜三级| 国产一区二区三区的电影| 亚洲高清在线播放| 一本色道久久综合亚洲精品不| 亚洲免费在线视频| 久久久久久久久伊人| 亚洲国产合集| 亚洲永久精品大片| 久久嫩草精品久久久精品| 欧美精品一区二区三区在线播放| 国产精品扒开腿爽爽爽视频| 国产综合精品一区| 一区二区三区产品免费精品久久75| 午夜日韩在线观看| 欧美高清视频在线| 亚洲影院一区| 男女激情久久| 国产欧美日韩亚洲精品| 91久久国产综合久久91精品网站| 亚洲免费综合| 欧美激情第10页| 午夜精品国产精品大乳美女| 欧美高清视频| 国产日韩欧美在线看| 夜夜爽av福利精品导航| 久色成人在线| 亚洲一区二区三区在线观看视频| 乱人伦精品视频在线观看| 国产精品久久久久久久久久直播| 亚洲经典自拍| 久久久久成人精品| 亚洲视频在线观看免费| 欧美a级一区| 激情校园亚洲| 久久久亚洲一区| 亚洲影院色无极综合| 欧美日韩一区三区|