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


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>
            亚洲大片免费看| 欧美成黄导航| 亚洲欧美综合一区| 国产精品日韩欧美大师| 亚洲一区在线观看视频| 亚洲欧美日韩系列| 在线看国产一区| 亚洲精品国精品久久99热| 欧美日韩一区二区三区免费看| 一区二区电影免费观看| 亚洲一区二区在| 黑人操亚洲美女惩罚| 亚洲国产欧美一区二区三区久久| 欧美日韩一区二区三区视频| 欧美在线观看一区二区| 麻豆精品在线视频| 亚洲综合999| 久久女同精品一区二区| 一本一本久久a久久精品牛牛影视| 99视频超级精品| 精品va天堂亚洲国产| 99re亚洲国产精品| 国内揄拍国内精品久久| 亚洲理论在线观看| 好吊一区二区三区| 一区二区三区精密机械公司 | 欧美在线你懂的| 91久久精品美女| 午夜精品在线观看| 99精品欧美一区二区三区| 午夜一区二区三区不卡视频| 亚洲精品一区二区三区四区高清| 亚洲一区二区三区视频播放| 亚洲少妇中出一区| 亚洲精品网站在线播放gif| 亚洲欧美大片| 亚洲裸体视频| 久久一区二区三区av| 亚洲欧美日韩天堂| 欧美日本在线一区| 欧美激情91| 伊人婷婷欧美激情| 小处雏高清一区二区三区| 99www免费人成精品| 欧美一站二站| 午夜精品视频在线| 欧美视频日韩视频在线观看| 欧美激情视频网站| 亚洲国产精品999| 久久大逼视频| 一二三四社区欧美黄| 亚洲国产福利在线| 性亚洲最疯狂xxxx高清| 亚洲小视频在线观看| 欧美激情一区二区三区在线视频| 久久久噜噜噜久久狠狠50岁| 国产精品视频免费观看| 在线观看亚洲视频| 欧美在线一二三| 久久精品视频网| 国产精品视频免费在线观看| 亚洲一级一区| 欧美在线看片| 国产一区二区精品久久99| 亚洲欧美在线aaa| 久久久国产一区二区三区| 国产精品日韩在线一区| 亚洲免费在线精品一区| 欧美一级二区| 国内外成人免费视频| 久久久久国产精品厨房| 欧美77777| 亚洲精品日韩综合观看成人91| 欧美福利精品| 一本一道久久综合狠狠老精东影业 | 亚洲一区二区视频| 欧美在线亚洲| 伊人成综合网伊人222| 蜜臀a∨国产成人精品| 亚洲国产一区二区精品专区| 99在线|亚洲一区二区| 欧美日韩亚洲视频| 亚洲网站在线观看| 另类图片国产| 日韩视频免费观看| 欧美午夜影院| 久久蜜桃资源一区二区老牛| 久久综合精品一区| 日韩午夜精品| 国产模特精品视频久久久久 | 亚洲免费视频在线观看| 乱码第一页成人| 日韩视频一区二区三区在线播放| 欧美视频国产精品| 欧美一区影院| 夜色激情一区二区| 久久久亚洲一区| 亚洲精品孕妇| 国产一区二区| 欧美激情第4页| 亚洲欧美成人一区二区在线电影| 蜜臀va亚洲va欧美va天堂| av72成人在线| 有码中文亚洲精品| 欧美日韩一区二区三区高清| 久久精品国产视频| 日韩视频专区| 免费不卡在线视频| 亚洲欧美伊人| 亚洲美女在线国产| 韩国成人理伦片免费播放| 欧美精品成人| 久久久久久久一区二区| 一个人看的www久久| 欧美.www| 欧美在线视频观看| 日韩一级大片在线| 一色屋精品视频免费看| 国产精品日韩久久久久| 欧美激情第三页| 久久精品国产欧美激情| 午夜精品国产| 一级日韩一区在线观看| 亚洲第一精品在线| 毛片基地黄久久久久久天堂| 亚洲欧洲av一区二区| 一本色道久久综合狠狠躁篇怎么玩| 国内精品久久久久影院薰衣草| 国产精品扒开腿爽爽爽视频 | 欧美日韩精品在线| 欧美1区2区3区| 久久资源在线| 久久综合免费视频影院| 久久精品一区二区三区不卡| 亚洲欧美在线一区二区| 一区二区三区免费看| 亚洲人成在线观看网站高清| 亚洲国产精品va在线观看黑人| 久久青草欧美一区二区三区| 欧美在线观看视频一区二区| 亚洲午夜激情| 亚洲特色特黄| 亚洲午夜精品| 亚洲综合国产精品| 香蕉av777xxx色综合一区| 亚洲一区图片| 欧美不卡视频一区| 欧美激情一区二区三区在线视频| 母乳一区在线观看| 欧美福利电影在线观看| 欧美日韩高清在线播放| 欧美日韩亚洲一区二区三区在线| 欧美日韩国产色视频| 欧美日韩国产在线| 国产精品久久久久久久久免费| 欧美四级电影网站| 国产精品欧美日韩久久| 国产精品综合| 在线日韩精品视频| 99精品国产高清一区二区| 亚洲午夜女主播在线直播| 亚洲制服欧美中文字幕中文字幕| 午夜精品久久久久久久| 久久福利资源站| 女人色偷偷aa久久天堂| 亚洲精品国产视频| 亚洲欧美日韩一区在线观看| 久久精品国产99国产精品澳门| 久久尤物视频| 欧美四级在线观看| 国产伦精品一区| 亚洲国产精品激情在线观看| 中文国产成人精品| 久久亚洲视频| 亚洲免费不卡| 久久精品91| 欧美日韩国产免费| 国产一区二区三区在线观看精品| 亚洲第一色在线| 午夜亚洲伦理| 欧美黄色一区| 午夜精品久久久久久久99黑人| 美女成人午夜| 国产精品视频一区二区高潮| 亚洲精品九九| 久久精品一级爱片| 亚洲久色影视| 久久亚洲一区二区三区四区| 国产精品久久国产精品99gif| 经典三级久久| 欧美一区1区三区3区公司| 亚洲国产高清在线观看视频| 午夜一区二区三区不卡视频| 欧美激情综合色综合啪啪| 国产综合欧美| 性欧美videos另类喷潮| 亚洲精品一区二区三区蜜桃久| 久久激情视频| 国产伦精品一区二区| 亚洲图片在区色|