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


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>
            欧美日韩一级大片网址| 亚洲激情视频在线播放| 国产日韩一区二区三区在线| 欧美国产日韩一区二区在线观看 | 欧美日韩亚洲综合在线| 欧美看片网站| 亚洲高清视频在线观看| 精品二区视频| 日韩午夜av在线| 亚洲在线1234| 久久人人爽人人| 亚洲国产精品国自产拍av秋霞| 91久久亚洲| 欧美亚洲网站| 欧美激情精品久久久久| 国产精品男人爽免费视频1| 国产一区二区三区在线免费观看| 在线日韩欧美| 亚洲欧美日韩一区二区三区在线观看 | 欧美日韩性生活视频| 国产精品成人一区二区三区夜夜夜 | 亚洲国产日韩美| 亚洲在线一区| 亚洲第一区在线| 香蕉久久一区二区不卡无毒影院 | 性欧美xxxx大乳国产app| 狼人天天伊人久久| 国产精品一区二区三区观看 | 久久精品日韩欧美| 亚洲国产欧美国产综合一区| 亚洲欧美另类久久久精品2019| 欧美aaa级| 狠狠色综合网站久久久久久久| 国产精品99久久久久久有的能看| 麻豆精品国产91久久久久久| 亚洲一区一卡| 欧美色一级片| 一区二区激情视频| 欧美成人伊人久久综合网| 亚洲欧美成人| 国产日韩欧美另类| 日韩午夜视频在线观看| 久热精品在线视频| 亚洲自啪免费| 欧美日韩一区二区在线观看| 亚洲国产另类 国产精品国产免费| 午夜精品久久久| 日韩午夜免费| 欧美另类视频在线| 亚洲欧洲在线观看| 欧美成人午夜激情视频| 久久精品国产一区二区三区免费看| 国产精品免费区二区三区观看| 99精品国产高清一区二区| 亚洲国产91| 欧美韩国在线| 亚洲精品国产精品国自产观看浪潮| 久久久精品五月天| 欧美一区观看| 激情文学一区| 一本色道久久| 亚洲伦理在线免费看| 欧美精品1区| 亚洲天堂av高清| 日韩视频精品| 国产精品嫩草久久久久| 欧美一级理论片| 午夜欧美大尺度福利影院在线看| 国产精品美女午夜av| 亚洲欧美中文日韩在线| 亚洲欧美三级在线| 激情另类综合| 欧美国产精品劲爆| 欧美片第1页综合| 亚洲欧美日韩精品久久奇米色影视| 亚洲素人一区二区| 国内精品久久久久久久果冻传媒| 另类尿喷潮videofree| 麻豆精品精华液| 亚洲手机视频| 久久国产精品久久久久久电车| 国产视频一区在线| 欧美 日韩 国产 一区| 欧美成人一区二区三区在线观看| 亚洲欧洲美洲综合色网| 国产精品99久久久久久久vr| 国产情人节一区| 欧美黄色一区| 国产欧美精品xxxx另类| 欧美激情a∨在线视频播放| 欧美视频福利| 久久视频免费观看| 欧美日韩成人一区二区三区| 欧美伊人久久大香线蕉综合69| 久久精品国产亚洲精品| 亚洲视频一区二区免费在线观看| 国产精品久久国产三级国电话系列 | 国产欧美日韩精品在线| 黄色在线一区| 亚洲精品三级| 激情国产一区| 在线视频亚洲| 亚洲理伦在线| 久久精品免费电影| 亚洲永久免费视频| 你懂的网址国产 欧美| 欧美在线3区| 欧美日韩国产色综合一二三四| 久久精品国产亚洲a| 欧美日韩国产综合视频在线观看| 久久久久免费观看| 国产精品欧美激情| 日韩写真视频在线观看| 亚洲国产日韩在线| 久久精品国产亚洲5555| 欧美一区网站| 国产精品福利片| 99精品热视频| 日韩视频中文字幕| 免播放器亚洲一区| 免费影视亚洲| 玉米视频成人免费看| 欧美一区亚洲一区| 欧美中文字幕在线观看| 国产精品国产馆在线真实露脸 | 久久三级福利| 久久久久久久久久久一区| 欧美午夜精品一区| 一区二区高清在线| 亚洲一级黄色| 欧美三级视频在线观看| 99视频一区二区| 亚洲一区日韩在线| 国产精品美女久久久久久2018| 夜夜嗨av一区二区三区免费区| 亚洲乱码一区二区| 欧美精品午夜视频| 亚洲清纯自拍| 一本色道综合亚洲| 欧美日韩中文在线| 一区二区三区久久精品| 亚洲欧美日韩成人高清在线一区| 国产精品久久国产精麻豆99网站| 亚洲午夜一区二区| 久久精品99国产精品日本| 国产婷婷精品| 久久免费精品视频| 亚洲福利精品| 亚洲自拍偷拍色片视频| 国产精品视频你懂的| 欧美有码在线观看视频| 免费日本视频一区| 在线亚洲一区观看| 国产欧美一区二区三区视频| 欧美一区二区三区精品电影| 免费亚洲一区| 亚洲一区图片| 国产综合精品| 欧美大片第1页| 亚洲一区二区三区中文字幕| 久久精品欧美日韩| 亚洲欧洲日韩在线| 国产精品久久久久久久第一福利 | 久久精品国产91精品亚洲| 久久成人在线| 亚洲日本视频| 国产精品婷婷| 久久影音先锋| 99亚洲一区二区| 欧美不卡三区| 亚洲一区二区三区中文字幕| 久久综合九色综合久99| 一本大道久久a久久精品综合| 国产精品丝袜久久久久久app| 久久久噜噜噜久久中文字免| 亚洲三级国产| 久久免费精品日本久久中文字幕| 亚洲日本一区二区三区| 国产午夜亚洲精品羞羞网站| 欧美风情在线观看| 午夜综合激情| 一区二区欧美日韩| 欧美va亚洲va香蕉在线| 亚洲欧美另类中文字幕| 91久久黄色| 狠狠色狠狠色综合日日五| 欧美视频免费看| 免费欧美高清视频| 欧美影院在线播放| 宅男噜噜噜66一区二区| 亚洲国产精品成人精品| 久久精品欧洲| 久久aⅴ国产欧美74aaa| 中文成人激情娱乐网| 亚洲国产高清视频| 激情文学综合丁香| 国产午夜精品久久久久久免费视| 欧美日韩国产成人在线免费| 久久久99国产精品免费| 亚洲欧美色一区|