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


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>
            欧美四级在线| 激情综合网激情| 亚洲一区日韩| 99这里只有精品| 国产精品高潮久久| 亚洲欧美日韩综合国产aⅴ| 亚洲美女在线看| 国产精品午夜电影| 久久久视频精品| 免费视频最近日韩| 99在线热播精品免费99热| 99视频一区| 国产日产欧产精品推荐色 | 国产亚洲欧美日韩日本| 久久er精品视频| 久久嫩草精品久久久精品一| 亚洲青涩在线| 在线一区二区三区四区| 国产亚洲在线观看| 欧美激情在线狂野欧美精品| 欧美精品国产| 欧美中文字幕在线观看| 久久性色av| 亚洲一区二区三区精品动漫| 亚洲欧美日韩中文播放| 91久久精品国产91久久性色| 一区二区三区 在线观看视频| 国内激情久久| 亚洲人体1000| 国产精品网红福利| 亚洲电影第三页| 国产毛片精品视频| 亚洲精品乱码久久久久| 国产亚洲一本大道中文在线| 亚洲日韩欧美视频| 国产网站欧美日韩免费精品在线观看 | 狠狠综合久久av一区二区小说| 亚洲国产欧美久久| 国产一区二区你懂的| 亚洲精品久久久久久久久久久久| 国产精品爽爽ⅴa在线观看| 欧美韩国日本一区| 国内激情久久| 亚洲一区在线观看视频| 一二三区精品福利视频| 久久精品亚洲一区二区三区浴池| 亚洲一区成人| 欧美日韩第一区| 蜜桃av噜噜一区二区三区| 国产欧美日韩激情| 一区二区三区国产在线| 亚洲免费成人av| 免播放器亚洲| 老牛国产精品一区的观看方式| 国产伦精品一区二区三区免费迷| 亚洲区在线播放| 亚洲精品日韩久久| 蜜桃精品久久久久久久免费影院| 久久中文欧美| 黄色一区二区三区| 欧美在线啊v一区| 久久精彩免费视频| 国产亚洲激情| 亚洲欧美日韩成人| 欧美一区二区三区视频免费播放| 欧美日韩人人澡狠狠躁视频| 亚洲日本中文字幕区| 亚洲毛片一区二区| 欧美欧美在线| 亚洲精品少妇| 一区二区高清视频| 欧美日韩一区三区| 日韩一级片网址| 亚洲欧美日韩精品综合在线观看 | 久久成人资源| 久久精彩免费视频| 国内精品久久久久久久果冻传媒 | 久久精品亚洲一区二区| 久久精品成人| 在线免费观看视频一区| 欧美bbbxxxxx| 日韩一区二区福利| 午夜在线一区| 免费成人黄色av| 亚洲美女视频在线免费观看| 欧美高清在线播放| 一区二区三区三区在线| 香蕉尹人综合在线观看| 国产一区二区三区四区在线观看| 久久福利电影| 最新日韩在线视频| 亚洲一区二区三区三| 国产综合久久久久影院| 麻豆国产精品777777在线| 亚洲日韩第九十九页| 欧美在线观看网站| 亚洲国产精品福利| 欧美性大战久久久久| 久久久999| 一区二区日韩欧美| 麻豆9191精品国产| 亚洲图片自拍偷拍| 激情小说另类小说亚洲欧美| 欧美日本精品在线| 久久国产精品色婷婷| 日韩视频精品在线| 毛片一区二区三区| 亚洲一区二区三区成人在线视频精品| 国产一二三精品| 欧美日韩一区二区在线视频| 久久黄色小说| 亚洲视频一二三| 亚洲国产精品电影| 久久久久国产精品麻豆ai换脸| 亚洲精品日产精品乱码不卡| 国产一区视频在线观看免费| 欧美日韩国产一级片| 久久精品一区二区三区不卡| 在线视频欧美精品| 91久久夜色精品国产九色| 久久免费视频观看| 欧美在线视频免费| 亚洲淫片在线视频| 亚洲美女黄网| 亚洲欧洲一区二区天堂久久| 国产一区二区三区高清在线观看| 国产精品www| 欧美日韩一区二区三区在线 | 一区二区三区精品国产| 亚洲福利视频网| 免费亚洲一区| 久久一日本道色综合久久| 欧美一级一区| 香蕉久久一区二区不卡无毒影院| 亚洲乱码久久| 亚洲精品久久久一区二区三区| 在线精品福利| 激情一区二区| 伊人春色精品| 在线不卡欧美| 亚洲国产高清视频| 亚洲动漫精品| 136国产福利精品导航网址应用| 国产亚洲欧美激情| 国产亚洲精品一区二555| 国产日韩一区二区| 国产亚洲欧洲| 激情文学综合丁香| 亚洲丰满在线| 亚洲精品乱码久久久久| 亚洲精品久久视频| 一区二区91| 亚洲一区二区三区免费观看| 亚洲综合第一页| 欧美一区二区国产| 久久免费视频这里只有精品| 美女视频黄a大片欧美| 欧美成人首页| 亚洲精品影院在线观看| 一区二区高清| 性色av一区二区三区在线观看| 久久精品99国产精品日本| 久久久久久久97| 欧美va天堂va视频va在线| 欧美乱大交xxxxx| 国产精品国产一区二区| 国产美女一区| 亚洲国产你懂的| 亚洲一区欧美二区| 久久久久www| 亚洲级视频在线观看免费1级| 夜夜狂射影院欧美极品| 欧美一级片久久久久久久| 久久在线免费观看视频| 欧美日韩精品欧美日韩精品| 国产伦一区二区三区色一情| 影音先锋在线一区| 一区二区三区四区蜜桃| 久久都是精品| 亚洲国产一区二区a毛片| 亚洲色诱最新| 欧美成人伊人久久综合网| 国产精品免费看| 亚洲二区精品| 欧美一级视频精品观看| 欧美成人影音| 亚洲欧美春色| 欧美高清在线视频| 国产综合av| 亚洲一区二区三区精品动漫| 免费久久久一本精品久久区| 夜夜狂射影院欧美极品| 老牛国产精品一区的观看方式| 国产精品嫩草影院av蜜臀| 亚洲免费av观看| 免费人成网站在线观看欧美高清| 中日韩美女免费视频网站在线观看| 久久亚洲欧洲| 国产女主播一区| 亚洲天堂成人在线观看|