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


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
/*************************************
計算幾何基礎題,判斷直線相交及求交點
注意斜率不存在的情況
*************************************
*/

#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 閱讀(822) 評論(0)  編輯 收藏 引用 所屬分類: 計算幾何POJ
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            久久一区亚洲| 日韩视频在线永久播放| 亚洲欧美成人一区二区在线电影| 欧美一区二区三区免费看| 在线视频你懂得一区二区三区| 亚洲精品乱码久久久久久按摩观| 亚洲精品美女91| 欧美福利视频在线| 日韩视频二区| 亚洲午夜在线观看视频在线| 国产欧美精品日韩精品| 久久嫩草精品久久久精品| 久久久蜜桃一区二区人| 亚洲人成亚洲人成在线观看图片| 欧美一级久久| 国模叶桐国产精品一区| 欧美刺激午夜性久久久久久久| 亚洲蜜桃精久久久久久久| 欧美偷拍一区二区| 久久夜色精品国产噜噜av| 免费久久99精品国产自| 一区二区国产日产| 亚洲欧美日韩久久精品 | 亚洲免费在线看| 亚洲一区二区免费在线| 影音先锋在线一区| 一区二区高清在线观看| 国内精品久久久久久影视8| 欧美成人免费va影院高清| 欧美日本精品| 久久伊人亚洲| 国产精品国产三级国产普通话99| 亚洲日本成人在线观看| 一区二区三区欧美| 狠狠色香婷婷久久亚洲精品| 亚洲黄色尤物视频| 黄色av日韩| 亚洲一二三四区| 亚洲精品日韩久久| 久久久久国产免费免费| 羞羞视频在线观看欧美| 欧美猛交免费看| 免费观看成人www动漫视频| 国产精品国产三级国产普通话三级 | 欧美理论电影在线观看| 久久精品一区二区三区不卡| 欧美激情国产精品| 久久婷婷国产麻豆91天堂| 国产精品99一区| 亚洲高清av在线| 国产主播一区| 亚洲一级网站| 亚洲一区精品视频| 欧美日韩国产影院| 亚洲第一综合天堂另类专| 韩国在线视频一区| 先锋影音网一区二区| 亚洲一区二区三区精品在线| 欧美精品一区二区高清在线观看| 中文欧美日韩| 欧美成人亚洲成人| 久久综合亚洲社区| 狠狠色狠狠色综合日日小说| 亚洲一区二区三区精品视频| 亚洲婷婷在线| 欧美亚韩一区| 亚洲一区视频在线| 久久成人国产精品| 国产欧美日本一区二区三区| 亚洲一级黄色av| 欧美在线91| 91久久久久| 欧美高清视频免费观看| 亚洲国内在线| 亚洲少妇中出一区| 国产精品成人在线观看| 亚洲字幕一区二区| 久久狠狠亚洲综合| 国产一区二三区| 久久这里有精品15一区二区三区| 99视频一区二区| 欧美激情亚洲综合一区| 亚洲美女电影在线| 亚洲免费视频成人| 国产一区二区三区电影在线观看| 亚洲欧洲精品成人久久奇米网| 国产精品久久久久久亚洲毛片 | 一区二区三区在线视频播放| 亚洲尤物视频在线| 久久人体大胆视频| 亚洲国产一区二区三区青草影视| 亚洲视频综合| 久久精品日产第一区二区三区| 欧美电影在线免费观看网站 | 国产综合色产| 久久精品日产第一区二区三区| 99精品欧美一区二区蜜桃免费| 亚洲欧美日韩精品综合在线观看| 91久久国产综合久久| 欧美日韩精品一区二区三区| 亚洲天堂网在线观看| 欧美中文在线观看| 亚洲电影免费观看高清| 欧美吻胸吃奶大尺度电影| 午夜欧美精品| 亚洲国产天堂网精品网站| 亚洲男人的天堂在线| 伊人色综合久久天天| 欧美视频1区| 久久综合伊人77777尤物| 亚洲视频一区| 欧美激情导航| 久久精品2019中文字幕| 99在线视频精品| 一区福利视频| 国产精品卡一卡二卡三| 欧美成人有码| 久久精品亚洲一区二区三区浴池| 久久国产99| 亚洲一二区在线| 亚洲日本中文字幕免费在线不卡| 久久亚洲图片| 午夜精品一区二区在线观看| 亚洲激情国产精品| 久久一本综合频道| 久久国产欧美日韩精品| 欧美α欧美αv大片| 欧美亚洲日本网站| 中国成人在线视频| 99re视频这里只有精品| 亚洲国产精品久久人人爱蜜臀| 久久精品亚洲乱码伦伦中文| 亚洲一区亚洲| 一本高清dvd不卡在线观看| 亚洲风情在线资源站| 久久中文欧美| 久久久999精品视频| 午夜日本精品| 午夜在线观看欧美| 亚洲欧美日韩爽爽影院| 亚洲免费成人av电影| 亚洲激情一区二区| 亚洲二区在线视频| 亚洲高清在线精品| 欲香欲色天天天综合和网| 国产一区二区三区在线观看免费 | 香蕉乱码成人久久天堂爱免费| 欧美亚洲视频一区二区| 99亚洲一区二区| 一区二区三区日韩精品| 日韩亚洲在线| 中文国产成人精品| 亚洲免费一区二区| 欧美亚洲视频| 久久久久久久97| 美女91精品| 欧美成人按摩| 91久久午夜| 一本综合精品| 亚洲综合三区| 久久不射网站| 欧美成年人在线观看| 欧美精品v国产精品v日韩精品| 午夜亚洲视频| 久久久久久一区二区| 久久午夜影视| 欧美—级a级欧美特级ar全黄| 欧美在线观看网站| 久久精品成人欧美大片古装| 久久婷婷久久一区二区三区| 欧美成人69av| 国产精品国产a| 国产专区欧美专区| 亚洲精品美女免费| 亚洲免费在线看| 美女主播视频一区| 日韩一二在线观看| 欧美资源在线观看| 欧美日韩国产高清| 国产婷婷97碰碰久久人人蜜臀| 欧美日韩视频在线观看一区二区三区 | 亚洲国内欧美| 亚洲尤物在线| 久久久国产一区二区| 亚洲国产精品久久久久秋霞蜜臀| 久久精品视频播放| 亚洲激情在线播放| 欧美一区二区三区在线看| 欧美成人嫩草网站| 国产日韩一区在线| 亚洲精品久久嫩草网站秘色 | 国产亚洲福利社区一区| 亚洲精品少妇网址| 久久精品一区中文字幕| 日韩视频在线观看| 久久er精品视频| 国产精品乱码一区二三区小蝌蚪 | 欧美精品v日韩精品v韩国精品v| 久久嫩草精品久久久久| 欧美日韩伊人|