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


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| 国产女优一区| 久久精品国产999大香线蕉| 午夜精品一区二区三区在线视| 国产精品一区二区你懂得| 欧美在线视频观看| 久久精品99无色码中文字幕| 精品成人久久| 亚洲黄色性网站| 国产精品二区三区四区| 久久精品国产99| 欧美成人国产va精品日本一级| 一区二区精品| 欧美一级二区| 亚洲乱码精品一二三四区日韩在线 | 亚洲免费视频观看| 韩国一区二区在线观看| 91久久一区二区| 国产精品三级视频| 亚洲第一二三四五区| 欧美大片在线观看一区二区| 欧美成人情趣视频| 午夜精品三级视频福利| 久久影院午夜论| 午夜精品一区二区三区在线视| 久久国产精彩视频| 亚洲一区二区视频在线| 欧美一级夜夜爽| 一区二区三区偷拍| 久久婷婷人人澡人人喊人人爽| 一本到高清视频免费精品| 久久爱www久久做| 亚洲网站在线| 美女主播视频一区| 久久久国产精品一区| 欧美日韩精品系列| 欧美激情视频在线播放| 国产亚洲欧美日韩一区二区| 亚洲人成网站在线播| 一区二区三区在线观看国产| 亚洲无线视频| 正在播放亚洲一区| 欧美xart系列高清| 麻豆av一区二区三区久久| 国产精品二区在线观看| 亚洲日本在线观看| 亚洲国产专区| 久久精品电影| 久久久精品日韩欧美| 国产精品久久久久久妇女6080| 亚洲黄色成人久久久| 亚洲国产精品美女| 欧美大秀在线观看| 国内精品一区二区三区| 亚洲免费一级电影| 午夜视频在线观看一区二区| 欧美日韩福利在线观看| 亚洲高清二区| 亚洲欧洲日韩女同| 欧美极品欧美精品欧美视频| 欧美大片专区| 亚洲国产精品www| 麻豆av福利av久久av| 免费观看30秒视频久久| 亚洲国产第一| 欧美激情一区在线| 亚洲精品免费网站| 亚洲影视九九影院在线观看| 国产精品激情电影| 亚洲一区二区三区在线| 欧美亚洲自偷自偷| 国产伪娘ts一区| 久久九九久久九九| 欧美国产综合| 亚洲最新中文字幕| 国产精品高潮在线| 午夜激情综合网| 麻豆成人综合网| 亚洲人www| 欧美午夜视频一区二区| 亚洲一区二区三区久久| 久久免费少妇高潮久久精品99| 国内不卡一区二区三区| 免费成人黄色片| 亚洲最新在线视频| 久久gogo国模啪啪人体图| 永久免费精品影视网站| 欧美精品久久天天躁| 亚洲在线免费视频| 美女视频黄a大片欧美| 亚洲激情一区二区| 国产精品高清网站| 久久精品视频免费| 亚洲欧洲视频| 久久国产99| 99在线热播精品免费99热| 国产精品女人久久久久久| 久久久噜久噜久久综合| 亚洲理伦电影| 美日韩在线观看| 一区二区三区精品视频在线观看| 国产女人精品视频| 欧美激情第9页| 欧美在线一二三四区| 亚洲欧洲综合另类| 久久久久久自在自线| 99国产精品国产精品毛片| 国产午夜精品全部视频在线播放| 你懂的网址国产 欧美| 先锋影音网一区二区| 亚洲人成久久| 欧美大片在线观看一区| 欧美亚洲综合网| 一区二区日韩精品| 亚洲电影毛片| 国产资源精品在线观看| 欧美日韩中文精品| 欧美国产精品专区| 久久久99免费视频| 午夜免费日韩视频| 一二三四社区欧美黄| 亚洲国产精品久久91精品| 久久久精品一区| 亚洲欧美一区二区精品久久久| 亚洲国产精品视频| 极品尤物一区二区三区| 久久蜜臀精品av| 一区二区成人精品| 亚洲第一福利视频| 国产一区二区中文| 国产精品推荐精品| 欧美日韩三级视频| 欧美国产日产韩国视频| 免费成人在线视频网站| 久久久久久电影| 久久精品国产2020观看福利| 亚洲欧美激情视频| 亚洲一区二区成人| 亚洲一区成人| 亚洲欧美一区二区视频| 亚洲午夜久久久久久久久电影院| av成人国产| 亚洲视频在线观看三级| 一本色道久久88综合亚洲精品ⅰ | 亚洲精品日韩在线观看| 亚洲国产毛片完整版 | 麻豆九一精品爱看视频在线观看免费| 欧美亚洲一区在线| 久久9热精品视频| 久久久久久电影| 免费久久99精品国产自在现线| 久久嫩草精品久久久精品一| 久久婷婷综合激情| 美女尤物久久精品| 亚洲高清视频一区二区| 亚洲人精品午夜| 一区二区免费看| 亚洲欧美一区二区原创| 欧美中文字幕在线观看| 麻豆精品91| 欧美日韩精品伦理作品在线免费观看| 欧美日韩一区二区三区在线视频| 欧美午夜电影在线观看| 国产色综合网| 亚洲欧洲视频在线| 亚洲特黄一级片| 久久精品国产视频| 亚洲第一久久影院| 夜夜嗨一区二区| 久久国产一区二区| 欧美精品粉嫩高潮一区二区 | 久久综合色一综合色88| 欧美精品一区二区三区蜜臀| 国产精品日韩专区| 亚洲国产欧美日韩| 亚洲天堂第二页| 美国成人毛片| 一区二区三区欧美日韩| 久久久久成人网| 欧美日韩不卡一区| 国产一区二区精品久久91| 91久久黄色| 久久激情视频| 亚洲欧洲在线视频| 久久精品麻豆| 欧美日韩色婷婷| 永久免费视频成人| 午夜国产精品影院在线观看| 欧美激情va永久在线播放| 亚洲一区二区三区高清 | 欧美日韩蜜桃| 国产一区自拍视频| 国产精品99久久久久久宅男 | 久久一区国产| 亚洲性av在线| 欧美日本国产精品| 1024成人| 久久日韩精品| 午夜在线观看免费一区|