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


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 閱讀(815) 評論(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>
            亚洲先锋成人| 亚洲久久一区二区| 亚洲盗摄视频| 亚洲欧美中日韩| 欧美福利电影网| 亚洲在线观看免费| 欧美午夜精品久久久久久浪潮| 伊人久久大香线| 欧美在线视频免费| 一区二区三区精品视频| 欧美激情视频在线播放| 亚洲国产精品ⅴa在线观看 | 亚洲日产国产精品| 久久久久久夜| 午夜一区在线| 国产欧美精品日韩| 亚洲欧美欧美一区二区三区| 日韩一级大片| 欧美日韩在线亚洲一区蜜芽| 日韩天堂在线视频| 亚洲精选在线| 欧美精品久久久久久久免费观看| 亚洲欧美日韩在线播放| 久久视频在线视频| 亚洲黄色一区| 亚洲国产精品久久久久婷婷老年| 毛片一区二区| 久久美女性网| 亚洲欧美中日韩| 欧美电影免费观看高清完整版| 亚洲人成欧美中文字幕| 亚洲激情国产| 欧美日韩免费看| 亚洲欧美中文另类| 欧美高清视频在线| 一区二区三区免费看| 一本久久综合亚洲鲁鲁| 亚洲第一网站| 性欧美1819sex性高清| 在线亚洲免费| 欧美精品国产一区| 欧美成人综合网站| 在线不卡中文字幕播放| 亚洲免费视频在线观看| 国产午夜精品在线观看| 美国十次成人| 欧美a级片网| 亚洲欧美日韩国产综合精品二区| 久热精品在线| 亚洲主播在线观看| 久久精品72免费观看| 91久久国产自产拍夜夜嗨| 欧美一区二区黄| 亚洲卡通欧美制服中文| 久久中文精品| 欧美成人精品激情在线观看| 欧美日韩亚洲高清一区二区| 亚洲国产专区| 亚洲免费av观看| 欧美成人dvd在线视频| 欧美国产视频日韩| 国产精品国产三级国产专区53 | 亚洲黄色小视频| 久久视频在线免费观看| 嫩草成人www欧美| 亚洲电影下载| 欧美r片在线| 亚洲欧洲三级| 亚洲无毛电影| 免费在线亚洲| 亚洲国产另类精品专区| 99视频精品在线| 久久免费视频在线| 欧美高清在线观看| 99在线精品视频在线观看| 欧美日韩国产一区二区三区地区| 久久天天躁夜夜躁狠狠躁2022| 欧美三区不卡| 亚洲欧美久久| 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲国产成人久久综合| 女主播福利一区| 一区二区三区欧美成人| 久久精品网址| 国产精品亚洲美女av网站| 亚洲欧洲日产国产综合网| 宅男噜噜噜66一区二区| 国产农村妇女精品一二区| 久久久久国产精品一区二区| 欧美一区二区三区免费看| 欧美视频亚洲视频| 欧美在线观看天堂一区二区三区 | 亚洲肉体裸体xxxx137| 欧美日韩视频| 欧美一区二视频| 亚洲人成在线影院| 亚洲精品社区| 国产日韩在线亚洲字幕中文| 欧美国产日韩在线| 午夜一区二区三区不卡视频| 亚洲国产二区| 99re成人精品视频| 国产一区二区无遮挡| 欧美在线日韩在线| 日韩网站在线| 免费日韩av| 欧美在线地址| 在线一区二区三区四区| 在线观看成人网| 国产精品乱人伦中文| 久久不射网站| 一卡二卡3卡四卡高清精品视频| 欧美主播一区二区三区美女 久久精品人| 亚洲高清不卡一区| 国产亚洲一区在线| 国产精品视频一区二区高潮| 欧美国产日韩一区| 久久午夜激情| 久久久91精品国产一区二区三区 | 国产精品jizz在线观看美国 | 国产精品99久久不卡二区| 国产精品99一区二区| 美日韩在线观看| 99爱精品视频| 久久久五月婷婷| 午夜久久美女| 亚洲一区二区三区视频播放| 亚洲美女视频在线观看| 亚洲国产精品99久久久久久久久| 国产曰批免费观看久久久| 欧美va亚洲va日韩∨a综合色| 香港成人在线视频| 翔田千里一区二区| 亚洲男人的天堂在线aⅴ视频| 亚洲先锋成人| 亚洲在线不卡| 欧美一级欧美一级在线播放| 亚洲免费视频一区二区| 亚洲女人天堂av| 午夜精品视频在线观看| 午夜免费电影一区在线观看| 亚洲欧美日韩精品久久奇米色影视| 免费成人在线视频网站| 免费成人网www| 亚洲第一主播视频| 亚洲人成啪啪网站| 99精品视频一区二区三区| 99www免费人成精品| 亚洲一区二区三区乱码aⅴ| 亚洲——在线| 久久久综合香蕉尹人综合网| 麻豆av一区二区三区| 欧美高清在线视频观看不卡| 欧美日韩国产首页在线观看| 欧美日韩精品一本二本三本| 国产精品国产a| 国产欧美一区二区三区国产幕精品| 国产一区二区三区黄| 在线电影一区| 在线亚洲精品| 欧美在线在线| 欧美黄色aa电影| 99亚洲精品| 久久精品国产清自在天天线| 麻豆精品91| 国产精品美女| 亚洲国产欧美一区| 亚洲一区二区在线免费观看视频| 久久精品一二三区| 亚洲欧美亚洲| 欧美jizz19性欧美| 一级日韩一区在线观看| 久久久综合激的五月天| 欧美日韩精品免费观看视频完整| 国产欧美日韩精品一区| 亚洲三级影片| 欧美在线一二三四区| 欧美黄色一区| 小黄鸭精品aⅴ导航网站入口| 免费看黄裸体一级大秀欧美| 国产精品日韩欧美| 亚洲欧洲精品天堂一级| 久久不射2019中文字幕| 亚洲经典在线| 久久精品国产久精国产爱| 欧美日韩亚洲一区二区| 一区二区三区在线视频观看| 在线观看精品一区| 午夜视频在线观看一区二区| 欧美激情在线免费观看| 欧美亚洲三区| 欧美三日本三级少妇三2023| 亚洲国产另类 国产精品国产免费| 亚洲欧美国产不卡| 亚洲精品网址在线观看| 麻豆91精品| 在线观看欧美日本| 久久精品视频在线观看| 中文精品在线| 久久久无码精品亚洲日韩按摩|