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


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 閱讀(822) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 計(jì)算幾何POJ

只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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| 黑人操亚洲美女惩罚| 性娇小13――14欧美| 中文精品视频| 国产精品亚洲成人| 久久久久九九九九| 久久精品国产清自在天天线| 伊人伊人伊人久久| 亚洲国产一区二区三区在线播 | 美女国产一区| 美女尤物久久精品| 在线视频精品一区| 亚洲与欧洲av电影| 在线免费观看日韩欧美| 亚洲福利久久| 国产精品欧美在线| 欧美成人高清| 久久婷婷人人澡人人喊人人爽| 久久久999精品视频| 最新日韩在线| 亚洲午夜伦理| 亚洲国产高清在线观看视频| 亚洲日本在线视频观看| 国产视频一区二区三区在线观看| 美女黄毛**国产精品啪啪| 欧美激情视频一区二区三区免费| 午夜视频在线观看一区| 老妇喷水一区二区三区| 午夜精品福利一区二区蜜股av| 欧美一级理论片| 一本久道久久综合中文字幕| 亚洲欧美日本在线| 亚洲理论在线| 久久精品理论片| 中文一区二区在线观看| 久久久久国产精品www | 国产免费一区二区三区香蕉精| 免费黄网站欧美| 国产精品乱码久久久久久| 欧美国产激情二区三区| 国产麻豆视频精品| 亚洲精品裸体| 亚洲国产成人av| 欧美一二三视频| 亚洲一区二区三区四区视频| 欧美不卡一区| 麻豆成人av| 国产一区在线视频| 亚洲一区二区三区免费视频| 日韩视频免费观看| 久久免费精品视频| 久久久xxx| 国产欧亚日韩视频| 亚洲综合成人在线| 亚洲欧美国产不卡| 快she精品国产999| 欧美激情麻豆| 免费黄网站欧美| 国产精品自在线| 99精品欧美一区二区三区| 亚洲韩国日本中文字幕| 久久久久久尹人网香蕉| 久久久免费精品视频| 国产免费亚洲高清| 亚洲欧美激情视频在线观看一区二区三区 | 美女日韩在线中文字幕| 韩日成人av| 久久国产精品久久久| 欧美日韩国产一中文字不卡| 欧美在线一区二区| 国产精品欧美久久| 国产精品女人久久久久久| 亚洲毛片在线观看.| 一区二区av在线| 欧美日韩在线播放一区二区| 在线亚洲免费| 亚洲免费一区二区| 国产美女精品视频| 久久av一区二区| 女女同性女同一区二区三区91| 伊人一区二区三区久久精品| 久久综合网hezyo| 最新亚洲一区| 亚洲欧美国产不卡| 国产亚洲欧美一区二区三区| 久久国产综合精品| 欧美国产日韩xxxxx| 99精品热6080yy久久| 欧美性事免费在线观看| 午夜欧美理论片| 欧美大片免费| 亚洲亚洲精品在线观看| 国产日韩欧美精品| 蘑菇福利视频一区播放| 99国产精品国产精品毛片| 久久国产精品久久久久久| 亚洲国产精品黑人久久久| 欧美日韩成人在线播放| 亚洲欧美视频一区| 欧美肥婆在线| 亚洲免费中文| 亚洲电影一级黄| 国产精品久久久久久久久婷婷 | 午夜免费电影一区在线观看| 免费一区视频| 亚洲在线1234| 亚洲国产精品www| 国产精品卡一卡二卡三| 免费成人黄色片| 亚洲伊人第一页| 亚洲精品1区| 久久亚洲精品一区二区| 一本高清dvd不卡在线观看| 国产亚洲一级高清| 欧美日韩亚洲一区在线观看| 欧美一区二区视频在线观看2020| 亚洲精品美女在线观看| 久久视频在线视频| 亚洲一区黄色| 亚洲精品国久久99热| 国产亚洲欧美日韩日本| 欧美日韩在线综合| 欧美v国产在线一区二区三区| 亚洲欧美日韩国产中文| 亚洲精选在线| 亚洲国内欧美| 欧美不卡激情三级在线观看| 久久黄色影院| 亚洲欧美日韩精品在线| 一区二区激情小说| 亚洲国产精品成人| 韩日视频一区| 国产亚洲亚洲| 国产亚洲欧美色| 国产日韩在线不卡| 国产精品一区视频| 国产精品久久久久91| 欧美视频在线观看一区| 欧美日韩国产免费| 欧美精品一区二区三区蜜臀| 欧美成ee人免费视频| 久久久另类综合| 久久精品视频免费播放| 欧美在线资源| 久久久www成人免费无遮挡大片| 性色一区二区三区| 久久精品国产欧美亚洲人人爽| 欧美亚洲日本一区| 久久精品日韩欧美| 久久久久久欧美| 久久综合九色| 欧美经典一区二区三区| 欧美日一区二区在线观看| 国产精品高清网站| 国产麻豆一精品一av一免费| 国产午夜精品久久久| 国内不卡一区二区三区| 亚洲成色777777女色窝| 91久久国产综合久久蜜月精品| 亚洲精选在线观看| 亚洲综合精品一区二区| 欧美有码视频| 你懂的国产精品| 亚洲人成网站在线播| 一区二区三区国产在线观看| 亚洲欧美日韩在线| 久久香蕉国产线看观看av| 欧美国产大片| 国产精品视频免费观看www| 黑丝一区二区| 亚洲伦理在线| 性欧美大战久久久久久久久| 久久人91精品久久久久久不卡| 免费在线观看成人av| 日韩亚洲成人av在线| 亚洲欧美另类在线| 欧美α欧美αv大片| 国产精品久久久一区二区| 一区国产精品| 亚洲先锋成人| 女仆av观看一区| 99re6这里只有精品| 久久精品国产精品亚洲精品| 欧美日本韩国一区二区三区| 国产精品高清一区二区三区| ●精品国产综合乱码久久久久| 在线亚洲观看| 老妇喷水一区二区三区| 夜夜精品视频| 免费视频一区| 国产日韩精品一区| 在线中文字幕一区| 欧美成人按摩| 亚洲女同精品视频| 欧美区一区二区三区| 亚洲电影自拍| 久久精品免费| 亚洲免费小视频| 欧美日韩一区二区在线观看|