两条直线可能有三种关系:1.共线     2.平行(不包括共线)    3.相交. 那给定两条直线怎么判断他们的位置关系呢.还是用到向量的叉积 例题:POJ 1269 题意:这道题是给定四个点p1, p2, p3, p4,直线L1,L2分别穿过前两个和后两个点.来判断直线L1和L2的关系 这三种关系一个一个来看: 1. 共线. 如果两条直线共线的话,那么另外一条直线上的点一定在这一条直线上.所以p3在p1p2上,所以用get_direction(p1, p2, p3)来判断p3相对于p1p2的关…
题目大意: t个测试用例 每次给出一对直线的两点 判断直线的相对关系 平行输出NODE 重合输出LINE 相交输出POINT和交点坐标 1.直线平行 两向量叉积为0 2.求两直线ab与cd交点 设直线ab上点为 a+(b-a)t,t为变量 交点需满足在直线cd上 则(d-c)*(a+t(b-a)-c)=0(外积) 分解为加减式 将t放在等号左边 其他放在右边 化简推导得t=(d-c)*(c-a)/(d-c)*(b-a) 则交点为a+(b-a)*((d-c)*(c-a)/(d-c)*(b-a))…
题目传送门 题意:判断两条直线的位置关系,共线或平行或相交 分析:先判断平行还是共线,最后就是相交.平行用叉积判断向量,共线的话也用叉积判断点,相交求交点 /************************************************ * Author :Running_Time * Created Time :2015/10/24 星期六 09:08:55 * File Name :POJ_1269.cpp *********************************…
题目传送门:POJ 1269 Intersecting Lines 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…
题目:POJ1269 题意:给你两条直线的坐标,判断两条直线是否共线.平行.相交,若相交,求出交点. 思路:直线相交判断.如果相交求交点. 首先先判断是否共线,之后判断是否平行,如果都不是就直接求交点了. #include <iostream> #include <string.h> #include <stdio.h> #include <algorithm> #include <math.h> #include <queue> #…
本文告诉大家获得两条一般式直线距离 一般式的意思就是 Ax+By+C=0" role="presentation">Ax+By+C=0Ax+By+C=0 如果有两个直线 A1x+B1y+C1=0A2x+B2y+C2=0" role="presentation">A1x+B1y+C1=0A2x+B2y+C2=0A1x+B1y+C1=0A2x+B2y+C2=0 如何判断两条直线的距离? 如果需要判断两条直线的距离,首先两条直线需要是平行…
title author date CreateTime categories C# 判断两条直线距离 lindexi 2018-07-31 14:38:13 +0800 2018-05-08 10:32:50 +0800 数学 C# 几何 本文告诉大家获得两条一般式直线距离. 一般式的意思就是 $$ Ax+By+C=0 $$ 如果有两个直线 $$ A_1x+B_1y+C_1=0 \ A_2x+B_2y+C_2=0 $$ 如何判断两条直线的距离? 如果需要判断两条直线的距离,首先两条直线需要是平…
题目链接:POJ 1269 Problem 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 becau…
题意:给两条直线,判断相交,重合或者平行 思路:判断重合可以用叉积,平行用斜率,其他情况即为相交. 求交点: 这里也用到叉积的原理.假设交点为p0(x0,y0).则有: (p1-p0)X(p2-p0)=0 (p3-p0)X(p2-p0)=0 展开后即是 (y1-y2)x0+(x2-x1)y0+x1y2-x2y1=0 (y3-y4)x0+(x4-x3)y0+x3y4-x4y3=0 将x0,y0作为变量求解二元一次方程组. 假设有二元一次方程组 a1x+b1y+c1=0; a2x+b2y+c2=0…
Intersecting Lines Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8342   Accepted: 3789 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…