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


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

#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 閱讀(815) 評論(0)  編輯 收藏 引用 所屬分類: 計(jì)算幾何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>
            亚洲日韩视频| 国产麻豆精品theporn| 国产日韩在线视频| 午夜欧美大片免费观看| 亚洲美女电影在线| 欧美激情一区二区三区在线| 亚洲国产视频一区| 久久久在线视频| 久久精品成人一区二区三区| 国内一区二区三区在线视频| 日韩一级成人av| 亚洲国产精品久久久久婷婷老年| 久久伊人免费视频| 国产日韩欧美综合精品| 欧美影视一区| 久久国产精品99久久久久久老狼| 欧美视频在线一区二区三区| 亚洲伊人观看| 午夜精品一区二区三区在线视 | 欧美一级欧美一级在线播放| 99国产精品一区| 国产精品久久7| 久久久国产亚洲精品| 久久性天堂网| 日韩西西人体444www| 在线性视频日韩欧美| 国产精品美女www爽爽爽| 午夜精品久久久久久久99水蜜桃| 一本色道88久久加勒比精品 | 欧美一区二区三区日韩| 午夜国产不卡在线观看视频| 国产综合欧美| 亚洲精品久久久久中文字幕欢迎你| 欧美性猛交xxxx免费看久久久| 久久午夜视频| 亚洲黄色高清| 一本色道久久| 国产日韩在线视频| 亚洲第一成人在线| 国产伦精品一区二区三| 欧美激情一区二区三区高清视频 | 亚洲美女视频在线免费观看| 国产精品视频九色porn| 欧美肥婆bbw| 国产精品看片你懂得| 猛男gaygay欧美视频| 欧美日韩中文字幕精品| 久久综合五月| 久久婷婷麻豆| 欧美一级一区| 欧美日韩精品一区二区天天拍小说| 久久网站热最新地址| 国产日本欧美一区二区三区| 一区二区三区产品免费精品久久75| 最新亚洲激情| 乱码第一页成人| 欧美暴力喷水在线| 亚洲国产日本| 蜜臀av性久久久久蜜臀aⅴ四虎 | 欧美一区二视频| 国产欧美一区二区在线观看| 99国产精品久久久久久久| 亚洲免费电影在线| 欧美精品福利在线| 日韩视频在线你懂得| 亚洲天堂av图片| 国产精品国产亚洲精品看不卡15| 99精品福利视频| 亚洲永久免费视频| 国产精品网站视频| 午夜精品福利视频| 久久青青草综合| 伊人一区二区三区久久精品| 老鸭窝毛片一区二区三区 | 久久久av网站| 伊人精品成人久久综合软件| 久久野战av| 亚洲黄色尤物视频| 国产精品99久久久久久宅男| 国产精品久久久久9999高清| 亚洲欧美国产日韩中文字幕| 久久久精彩视频| 亚洲国产日韩欧美综合久久 | 亚洲欧美国产一区二区三区| 久久九九精品| 亚洲激情av在线| 欧美日韩在线播放三区| 欧美一区二区成人6969| 欧美国产日韩一区| 宅男噜噜噜66一区二区66| 国产精品视频精品视频| 久久久免费精品视频| 亚洲精品资源美女情侣酒店| 午夜宅男久久久| 亚洲国产91精品在线观看| 欧美日韩精品免费看| 欧美一区二区精品在线| 亚洲福利一区| 久久影音先锋| 亚洲视频精选在线| 欧美成人精品在线播放| 亚洲视频一二区| 国产一区二区在线观看免费播放| 免费视频亚洲| 欧美中文在线视频| 一区二区av| 欧美激情91| 久久精品视频在线观看| 中文精品99久久国产香蕉| 国产自产女人91一区在线观看| 欧美日韩国产一级| 免费看的黄色欧美网站| 性刺激综合网| 亚洲一区二区黄| 亚洲国产三级在线| 免费成人在线观看视频| 欧美一区二视频在线免费观看| 夜夜爽夜夜爽精品视频| 一区二区在线看| 国产一区二区三区精品欧美日韩一区二区三区| 欧美成人一区二区| 久久激五月天综合精品| 亚洲一区免费视频| 99伊人成综合| 亚洲高清一二三区| 模特精品裸拍一区| 久久久久久久精| 亚洲专区免费| 亚洲视频你懂的| 99精品视频免费观看视频| 亚洲国产精品一区二区www在线| 国产欧美一区二区精品忘忧草| 国产精品国产三级国产专播品爱网 | 一区二区欧美国产| 日韩天天综合| 日韩视频一区二区三区在线播放 | 国产精品日韩欧美一区二区三区 | 久久国产夜色精品鲁鲁99| 亚洲欧美视频一区| 亚洲欧美中文日韩v在线观看| 亚洲少妇诱惑| 亚洲一区二区免费视频| 一本色道久久综合| 一区二区三区四区在线| 国产精品99久久久久久有的能看 | 欧美成人午夜免费视在线看片| 久久先锋影音av| 蜜桃久久av一区| 欧美国产日韩精品免费观看| 欧美激情视频一区二区三区不卡| 久久久久国产精品www| 久久久xxx| 欧美成人精品高清在线播放| 亚洲福利久久| 亚洲精品日韩在线观看| 一区二区三区四区国产| 亚洲一区二区网站| 久久国产精品一区二区三区| 久久免费视频在线观看| 欧美精品国产一区二区| 欧美系列一区| 国产综合色在线| 亚洲精品在线免费| 亚洲欧美日韩国产中文在线| 久久国产精品99国产| 欧美成人dvd在线视频| 最新亚洲电影| 亚洲欧美中文在线视频| 久久亚洲欧洲| 欧美无砖砖区免费| 亚洲黄色在线观看| 一区二区精品国产| 久久久噜噜噜久久中文字幕色伊伊| 女仆av观看一区| 国产麻豆成人精品| 亚洲人体大胆视频| 欧美夜福利tv在线| 亚洲国产你懂的| 午夜精品免费视频| 欧美成人精品福利| 国产日韩欧美制服另类| 亚洲美女中出| 老司机午夜精品视频| 日韩午夜免费视频| 久久伊人免费视频| 国产欧美日韩免费看aⅴ视频| 亚洲人成高清| 久久久噜噜噜| 一区二区欧美国产| 美女啪啪无遮挡免费久久网站| 国产精品久久久久久久一区探花 | 欧美在线free| 日韩系列欧美系列| 蜜桃av综合| 激情欧美亚洲| 欧美中文字幕在线视频| 日韩视频一区| 欧美国产日韩一区二区三区| 国产一区二区三区四区老人| 亚洲免费中文|