poj1269】的更多相关文章

题目:POJ1269 题意:给你两条直线的坐标,判断两条直线是否共线.平行.相交,若相交,求出交点. 思路:直线相交判断.如果相交求交点. 首先先判断是否共线,之后判断是否平行,如果都不是就直接求交点了. #include <iostream> #include <string.h> #include <stdio.h> #include <algorithm> #include <math.h> #include <queue> #…
题目链接:https://vjudge.net/problem/POJ-1269 题意:给出4个顶点,表示两条直线,求这两条直线的相交情况,重合输出LINE,平行输出NONE,相交于一点输出该点的距离. 思路: 用叉积判断直线的重合和平行,并且可以用叉积求相交直线的交点. 用叉积求直线交点的模板: double t=((a-c)^(c-d))/((a-b)^(c-d)); ans=Point(a.x+(b.x-a.x)*t,a.y+(b.y-a.y)*t) 证明见https://www.cnbl…
求相交点 /* 线段相交模板:判相交.求交点 */ #include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> ; struct Point{ double x,y; }; Point P_ans; double cross( Point a,Point b,Point c ){ return ( b.x-a.x )*( c.y-a.y )-( b.y-a.y )*( c.…
传送门:Intersecting Lines 题意:给出N组直线,每组2条直线,求出直线是否相交.如果共线则输出LINE,相交则输入点坐标,否则输出NONE. 分析:模板裸题,直接上模板... #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <queue> #include <map> #include &…
基础题,直线间关系 #include <iostream> #include <math.h> #include <iomanip> #define eps 1e-8 #define zero(x) (((x)>0?(x):-(x))<eps) #define pi acos(-1.0) struct point { double x, y; }; struct line { point a, b; }; struct point3 { double x,…
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…
Intersecting Lines Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 15145   Accepted: 6640 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…
Intersecting Lines Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16681   Accepted: 7192 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…
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…
题目大意:求两条直线的交点坐标. 解题关键:叉积的运用. 证明: 直线的一般方程为$F(x) = ax + by + c = 0$.既然我们已经知道直线的两个点,假设为$(x_0,y_0), (x_1, y_1)$,那么可以得到$a = {y_0} - {y_1}$,$b = x_1 – x_0$,$c = x_0y_1 – x_1y_0$. 因此我们可以将两条直线分别表示为 ${F_0}(x) = {\rm{ }}{a_0}x{\rm{ }} + {\rm{ }}{b_0}y{\rm{ }}…