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


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 閱讀(829) 評論(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>
            亚洲日本免费电影| 久久综合久久综合这里只有精品| 欧美成人高清| 狂野欧美激情性xxxx| 在线免费高清一区二区三区| 欧美国产三级| 欧美日韩一区二区在线视频| 亚洲欧美日韩直播| 欧美一区午夜精品| 亚洲国产精品99久久久久久久久| 亚洲国产高清一区| 欧美日韩亚洲高清| 久久国产黑丝| 你懂的视频欧美| 亚洲一区二区三区视频播放| 午夜精品久久久久久久白皮肤| 激情欧美一区二区| 亚洲精品日本| 国产日韩欧美不卡| 亚洲福利国产精品| 国产精品永久| 亚洲国产精品久久久久秋霞影院| 国产精品vvv| 六月天综合网| 国产精品成人午夜| 欧美成人一区在线| 国产女主播视频一区二区| 欧美va亚洲va香蕉在线| 国产精品黄色在线观看| 欧美sm视频| 国产伦精品一区二区三区免费| 欧美成人福利视频| 国产欧美另类| 夜夜精品视频一区二区| 在线欧美视频| 性感少妇一区| 亚洲一区二区三区影院| 欧美成人69av| 久久亚洲综合| 国产欧美视频一区二区| 亚洲欧洲在线观看| 尹人成人综合网| 亚洲一级黄色av| 一区二区精品| 蜜桃av一区| 久久久久久久网| 国产精品看片你懂得| 欧美国产第二页| 狠狠色噜噜狠狠狠狠色吗综合| 亚洲美女诱惑| 亚洲精品美女91| 乱中年女人伦av一区二区| 久久国产精品黑丝| 国产精品一区一区| 亚洲网站视频| 亚洲自拍高清| 国产精品欧美精品| 一区二区三区四区五区在线| 日韩五码在线| 欧美日韩大片| 9色porny自拍视频一区二区| 日韩一级片网址| 欧美精品一卡二卡| 亚洲精品美女| 亚洲你懂的在线视频| 欧美亚洲成人精品| 亚洲一区二区成人| 欧美一区二区成人| 国产欧美日韩亚洲一区二区三区| 亚洲欧美成人一区二区在线电影| 亚洲综合色视频| 国产美女搞久久| 久久爱91午夜羞羞| 美日韩丰满少妇在线观看| 一区在线电影| 欧美激情bt| 中文日韩欧美| 久久九九免费视频| 在线欧美日韩精品| 欧美福利视频在线| 夜夜爽av福利精品导航 | 久久香蕉国产线看观看av| 欧美影院久久久| 精品动漫3d一区二区三区免费| 久久人人精品| 亚洲免费成人av| 香港成人在线视频| 国内精品久久久久影院优| 免费观看亚洲视频大全| 91久久久亚洲精品| 午夜日韩视频| 亚洲国产日韩一区二区| 欧美日韩成人在线视频| 午夜亚洲精品| 亚洲国产日韩欧美一区二区三区| 亚洲视屏一区| 在线观看成人av电影| 欧美日韩精品欧美日韩精品一| 亚洲综合第一页| 欧美激情在线狂野欧美精品| 亚洲色图在线视频| 伊人春色精品| 国产精品vvv| 欧美11—12娇小xxxx| 亚洲一区二区3| 亚洲二区三区四区| 欧美在线地址| 一本到高清视频免费精品| 国产一区二区成人久久免费影院| 欧美成人国产va精品日本一级| 亚洲一区二区三区在线| 亚洲国产成人av| 久久久久久久久一区二区| 夜夜爽av福利精品导航| 激情久久中文字幕| 国产精品美女一区二区| 欧美成人小视频| 久久天天狠狠| 欧美中文字幕久久| 亚洲午夜久久久| 亚洲乱码国产乱码精品精| 欧美 日韩 国产一区二区在线视频| 亚洲男人的天堂在线| 亚洲精品自在久久| 亚洲风情在线资源站| 国产香蕉久久精品综合网| 欧美日韩在线视频一区二区| 欧美大香线蕉线伊人久久国产精品| 欧美中文在线观看| 亚洲欧美一区二区三区极速播放 | 亚洲一区二区在线视频| 欧美黄污视频| 欧美成人免费小视频| 久久人人97超碰国产公开结果 | 亚洲毛片视频| ●精品国产综合乱码久久久久| 国产日韩欧美综合| 国产九九精品视频| 国产精品亚洲а∨天堂免在线| 欧美日韩一二区| 欧美日一区二区在线观看 | 国产精品一区免费视频| 国产精品www色诱视频| 欧美另类videos死尸| 欧美精品一卡| 欧美日韩另类一区| 欧美四级剧情无删版影片| 欧美日韩综合不卡| 国产精品夫妻自拍| 国产精品日韩欧美一区二区三区| 国产精品第十页| 国产精品揄拍500视频| 国产欧美日韩91| 激情久久久久久久| 亚洲国产精品日韩| 99精品热6080yy久久| 亚洲一区二区三区欧美| 欧美一区二区三区四区在线观看地址| 欧美一区二区三区视频免费| 久久激情五月婷婷| 欧美/亚洲一区| 亚洲日本乱码在线观看| 中国日韩欧美久久久久久久久| 亚洲欧美国产日韩中文字幕| 久久激情网站| 欧美刺激性大交免费视频| 国产精品igao视频网网址不卡日韩| 国产精品久久| 激情欧美一区| 亚洲视频在线观看视频| 久久成人人人人精品欧| 欧美91大片| 中文一区二区| 老**午夜毛片一区二区三区| 欧美日韩国产色综合一二三四| 国产精品综合不卡av| 一区二区三区自拍| 亚洲视频第一页| 久热精品在线视频| 99热精品在线| 久久综合给合久久狠狠狠97色69| 欧美区一区二区三区| 国产欧美日韩视频| 亚洲精品在线观| 久久国产免费| 99国产精品99久久久久久粉嫩| 欧美一区二区三区精品电影| 欧美成人一区二区三区片免费| 国产精品一区二区三区久久久 | 亚洲福利精品| 亚洲自拍高清| 最新高清无码专区| 欧美在线不卡| 国产精品国产三级国产| 亚洲国内在线| 久久中文久久字幕| 亚洲私人影院在线观看| 欧美xx视频| 一区一区视频| 久久国产精品一区二区三区|