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


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>
            亚洲一区二区综合| 欧美成人久久| 一区二区三区日韩精品| 欧美日韩国产123区| 一本大道av伊人久久综合| 亚洲精品国精品久久99热| 欧美区亚洲区| 亚洲一区三区在线观看| 亚洲欧美日产图| 影音先锋亚洲电影| 欧美激情精品久久久久久变态 | 欧美一区视频在线| 亚洲欧美日韩在线播放| 国内精品一区二区三区| 亚洲福利小视频| 国产精品99免费看 | 99视频一区二区| 国产精品普通话对白| 久久久噜噜噜久噜久久| 美女网站久久| 午夜在线a亚洲v天堂网2018| 久久精品国产亚洲一区二区| 激情小说亚洲一区| 亚洲人体一区| 国产一区二区三区黄视频| 欧美高清在线观看| 国产精品亚洲激情| 欧美成人免费全部| 国产乱肥老妇国产一区二| 欧美福利电影网| 国产精品视频1区| 欧美国产欧美综合 | 欧美电影专区| 久久精精品视频| 欧美精品在线看| 久久精品国产免费观看| 欧美精品v日韩精品v国产精品| 午夜精品久久久久| 欧美精品99| 美女久久一区| 国产欧美一二三区| 99国产精品久久久久老师| 亚洲二区在线| 性视频1819p久久| 亚洲一区激情| 欧美精品在线视频| 欧美黄色视屏| 黄网站色欧美视频| 亚洲一区视频| 亚洲一区欧美激情| 欧美日韩高清免费| 亚洲福利视频专区| 一区二区三区在线视频免费观看| 亚洲男人的天堂在线aⅴ视频| 一本一道久久综合狠狠老精东影业| 久久精品成人一区二区三区蜜臀| 久久av二区| 国产日韩久久| 亚洲欧美一区在线| 欧美一区二区三区另类| 国产精品久久久久久久久久妞妞| 日韩一级在线| 亚洲一区二区三区免费观看 | 亚洲欧美日韩视频二区| 一本久道久久久| 欧美大片免费| 亚洲国产日韩在线| 亚洲日本一区二区三区| 欧美成人蜜桃| 日韩亚洲欧美精品| 亚洲视频电影图片偷拍一区| 欧美日韩一区二| 中文久久精品| 欧美一级欧美一级在线播放| 国产精品一区免费视频| 香蕉久久夜色精品国产| 久久综合成人精品亚洲另类欧美| 国产一区二区三区久久| 久久久美女艺术照精彩视频福利播放| 久久久久久精| 亚洲二区在线观看| 欧美日本高清视频| 亚洲一区二区在线免费观看| 欧美亚洲一区二区在线| 国内精品一区二区| 免费亚洲电影在线| 一区二区三区四区五区精品视频| 亚洲午夜视频在线| 国产一区视频在线看| 久久久久久久久综合| 亚洲国产婷婷香蕉久久久久久| 亚洲午夜伦理| 国产一区二区三区四区| 乱人伦精品视频在线观看| 亚洲三级电影在线观看| 欧美一区二区在线看| 亚洲国产成人精品久久久国产成人一区 | 一本色道久久加勒比精品| 欧美视频一区在线| 久久精精品视频| 亚洲日本电影在线| 久久激情视频免费观看| 亚洲人成高清| 国产精品久久久久婷婷| 久久视频一区二区| 中文国产一区| 亚洲第一页自拍| 午夜精彩国产免费不卡不顿大片| 在线看片一区| 国产欧美精品在线播放| 欧美成人日本| 欧美一区二区性| 亚洲精品美女久久久久| 久久午夜av| 午夜伦理片一区| 99精品欧美一区二区三区| 国产亚洲一区在线| 欧美视频在线视频| 欧美成人激情在线| 久久精品国产亚洲精品| 亚洲少妇自拍| 亚洲精品之草原avav久久| 免费一区二区三区| 久久久精品国产99久久精品芒果| 一本色道久久综合精品竹菊| 在线日韩视频| 国内精品一区二区三区| 国产精品一区在线观看| 国产精品sss| 欧美日韩日日骚| 欧美高清在线一区二区| 久久久亚洲国产天美传媒修理工| 午夜精品久久| 亚洲欧美日本视频在线观看| 国产精品99久久99久久久二8 | 亚洲午夜激情| 亚洲精品欧美日韩| 欧美国产一区二区在线观看| 久久亚洲国产成人| 久久久久综合| 久久久久免费视频| 久久久久.com| 久久蜜桃资源一区二区老牛| 久久精品国产亚洲一区二区| 香蕉av777xxx色综合一区| 亚洲欧美日韩精品久久亚洲区 | 中文成人激情娱乐网| 亚洲卡通欧美制服中文| 亚洲毛片在线观看.| 亚洲毛片网站| 亚洲天堂黄色| 亚洲欧美成aⅴ人在线观看| 亚洲一级黄色片| 亚洲一区精品电影| 性色一区二区| 久久久久这里只有精品| 你懂的视频一区二区| 欧美福利视频网站| 亚洲激情视频在线播放| 亚洲麻豆av| 亚洲一区二区视频| 久久gogo国模裸体人体| 毛片一区二区三区| 欧美日韩福利视频| 国产精品福利片| 国产视频欧美视频| 亚洲国产成人高清精品| 一本久久综合亚洲鲁鲁| 亚洲男同1069视频| 久久香蕉国产线看观看av| 欧美肥婆在线| 亚洲一二三四久久| 久久精品国产99国产精品澳门| 久久午夜视频| 国产精品第2页| 狠狠干成人综合网| 中文亚洲字幕| 久久久久女教师免费一区| 亚洲欧洲日本在线| 午夜一区二区三视频在线观看 | 亚洲欧美国产精品专区久久| 久久久xxx| 欧美视频在线观看一区| 好男人免费精品视频| 在线亚洲一区观看| 久久一区二区三区国产精品 | 久久伊人免费视频| 亚洲日韩欧美视频一区| 欧美中文字幕在线视频| 欧美精品综合| 韩国三级电影久久久久久| 一本一本a久久| 免费日韩av片| 欧美一区二区三区在线播放| 欧美激情1区2区| 国内精品一区二区| 欧美一级免费视频| 亚洲精品永久免费精品| 久久夜色精品国产亚洲aⅴ| 国产欧美精品日韩区二区麻豆天美 |