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


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>
            亚洲欧洲三级| 欧美在线啊v一区| 国自产拍偷拍福利精品免费一| 亚洲第一天堂av| 国产一区激情| 亚洲欧美日韩视频一区| 亚洲天天影视| 欧美色123| 亚洲美女视频在线观看| 亚洲伦理在线| 欧美成人官网二区| 欧美高清在线视频| 在线免费不卡视频| 久久另类ts人妖一区二区| 久久久99爱| 国产一区在线免费观看| 欧美一区二区三区男人的天堂| 欧美一区二区黄| 国产欧美日韩免费看aⅴ视频| 亚洲香蕉伊综合在人在线视看| 亚洲专区一区二区三区| 国产精品国产三级国产普通话99| 99成人在线| 欧美一区二区三区免费观看| 国产欧美日韩不卡免费| 亚洲欧美激情视频| 久久久噜噜噜久久狠狠50岁| 精品88久久久久88久久久| 久久婷婷国产综合国色天香| 欧美黑人多人双交| 日韩视频在线免费观看| 欧美精品久久久久久久| 亚洲麻豆国产自偷在线| 亚洲影视中文字幕| 国产欧美日韩三区| 久久亚洲电影| 亚洲日本中文字幕免费在线不卡| 日韩午夜剧场| 国产精品露脸自拍| 欧美在线www| 亚洲第一区中文99精品| 亚洲午夜免费视频| 国产亚洲日本欧美韩国| 美乳少妇欧美精品| 日韩视频免费观看高清在线视频 | 国产精品爽黄69| 欧美亚洲免费电影| 亚洲福利一区| 亚洲欧美一级二级三级| 激情成人av| 欧美日韩国产经典色站一区二区三区| 一区二区日韩免费看| 久久久久久久久综合| 亚洲精品一区二区在线观看| 欧美三区在线视频| 久久久久国产精品www| 亚洲美女av黄| 乱人伦精品视频在线观看| 一区二区三区欧美成人| 韩国av一区二区三区四区| 欧美伦理视频网站| 欧美一级大片在线观看| 亚洲免费电影在线观看| 每日更新成人在线视频| 亚洲一区三区在线观看| 亚洲二区在线视频| 国产精品久久久久久亚洲毛片| 久久视频免费观看| 亚洲欧美日韩直播| 亚洲精品国产精品国自产在线 | 国产日韩一区二区三区| 欧美韩日一区| 欧美在线免费播放| 亚洲午夜国产成人av电影男同| 免费亚洲一区二区| 欧美一区网站| 一区二区三区高清在线观看| 激情久久综艺| 国产色综合天天综合网| 欧美日韩免费一区二区三区视频| 久久久蜜桃一区二区人| 亚洲免费视频在线观看| 日韩一区二区免费高清| 欧美激情久久久久久| 久久嫩草精品久久久精品一| 性欧美xxxx大乳国产app| 一区二区三区四区五区精品视频 | 欧美网站大全在线观看| 欧美激情欧美狂野欧美精品| 美女主播精品视频一二三四| 久久久久青草大香线综合精品| 亚洲一区二区三区影院| 99re6这里只有精品| 亚洲精品久久久久| 亚洲国产乱码最新视频| 亚洲大胆视频| 亚洲国产片色| 亚洲精品乱码久久久久久日本蜜臀 | 国产精品入口夜色视频大尺度 | 国产日韩精品综合网站| 国产精品社区| 国产欧美韩国高清| 国产精品亚洲综合色区韩国| 国产精品麻豆va在线播放| 国产精品第一页第二页第三页| 欧美日韩中文字幕日韩欧美| 国产精品s色| 国产精品一区二区久久久久| 国产欧美一区二区精品忘忧草 | 中文精品99久久国产香蕉| 一区二区免费在线播放| 亚洲在线成人| 欧美一区二区免费观在线| 久久久久久久999| 美女脱光内衣内裤视频久久影院 | 欧美一区二区三区电影在线观看| 欧美一级视频精品观看| 久久成人18免费网站| 久久久精品日韩欧美| 欧美成人高清| 欧美日韩一区精品| 国产欧美一区在线| 亚洲二区免费| 亚洲视频一二区| 欧美在线视频二区| 欧美99在线视频观看| 亚洲肉体裸体xxxx137| 亚洲五月六月| 久久久久久久综合日本| 欧美国产日本在线| 国产精品久久久久久久久久三级| 好吊视频一区二区三区四区| 亚洲欧洲视频在线| 亚洲专区欧美专区| 裸体一区二区| 99国产精品一区| 欧美在线网址| 欧美激情一区二区| 国产日韩精品入口| 亚洲日本欧美天堂| 欧美一区二区精品| 亚洲国产精品久久久久婷婷老年| 一本色道久久99精品综合| 欧美在线视频网站| 欧美三级日韩三级国产三级| 国产一区二区三区免费不卡 | 欧美成人综合一区| 国产乱码精品一区二区三区五月婷 | 一区二区三区在线免费观看| 在线性视频日韩欧美| 久久夜色精品国产欧美乱| 日韩亚洲综合在线| 久久亚洲精品中文字幕冲田杏梨 | 99精品视频免费| 久久久综合免费视频| 中文一区二区| 欧美护士18xxxxhd| 一区二区三区中文在线观看 | 欧美日韩免费在线| 亚洲国产一区二区三区在线播| 亚洲欧美日韩一区二区三区在线观看 | 亚洲免费网站| 欧美日韩国产bt| 亚洲欧洲精品成人久久奇米网| 性欧美8khd高清极品| 日韩一区二区精品视频| 欧美大片在线看| 一区二区三区在线免费观看| 性久久久久久久| av成人老司机| 欧美日韩ab片| 99re这里只有精品6| 欧美激情四色| 久热这里只精品99re8久| 国产字幕视频一区二区| 亚洲欧美日韩成人| 国产精品99久久99久久久二8 | 久久夜色精品国产| 国产一区自拍视频| 久久成人综合网| 亚洲综合99| 国产欧美日韩精品在线| 亚洲影音先锋| 中国日韩欧美久久久久久久久| 欧美人与性禽动交情品 | 亚洲欧美精品在线| 国产精品视频一区二区三区| 亚洲欧美电影院| 亚洲一区欧美| 国产伦精品一区二区三区视频黑人| 亚洲一区免费视频| 亚洲一区国产一区| 国产美女精品一区二区三区| 久久国产精品一区二区三区四区 | 欧美午夜a级限制福利片| 亚洲字幕在线观看| 亚洲欧美日韩精品久久久久| 国语自产精品视频在线看抢先版结局 | 亚洲国产成人91精品| 欧美成人精品不卡视频在线观看 |