Questions tagged [line-intersection]

A common problem in is to find the intersection of two lines.

In the common case in two dimensions, the result is a point, which can be expressed as a parameter along one or both of the lines. For rays and line segments, the intersection of the containing lines is computed, then its parameters are checked to see whether the intersection falls within the subset of the line.

Common approaches produce poor answers for lines that are (nearly) parallel, so often an angle test is performed first. Parallel rays and line segments can intersect in a ray or line segment rather than a point.

Special search structures exist for finding intersections among many line segments.

In more than two dimensions, almost all pairs of lines have no intersection, but skew lines can be projected into the unique plane (through the origin) parallel to each. The intersection in that plane identifies the point of closest approach between the lines.

125 questions
0
votes
1 answer

Check if square intersects line in JavaScript

Given the position and dimensions of a square, what is the equation in JavaScript for testing if a line goes through the rectangle? What I have tried so far is: function isSquareIntersectingLine(square, line) { return ( line.startX >=…
user9085934
0
votes
1 answer

Line and rectangle intersection

I have a rectangle and a line segment inside the rectangle, and the line can be extended on both sides. I know the coordinates of the rectangle's four vertices as well as the line's two vertices. I try to write a function that would return the…
0
votes
1 answer

Finding an intersection on Matlab

I have two sets of data curves, x1,y1 and x1,y2. I wish to find the intersection between these two curves. However, I do not have the equation for x1,y1. Moreover, when using traditionnal intersection computing function, I get little to no result,…
Lu_
  • 1
0
votes
1 answer

3D vectors intersection using weighted least squares approach

I want to find the closest intersection point to multiple lines/vectors in 3D space but I want to weight the influence of each vector based on its length (the greater its length, the greater its influence). I am working with R. The answer to this…
0
votes
1 answer

Pandas columns line intersection

I've got a pandas dataframe where each column represents the y values of a descending line from 1 to 0 and the indexes represent the x values. Now I'm interested in finding the intersection points between these lines and a given constant (linearly…
Jurgy
  • 2,128
  • 1
  • 20
  • 33
0
votes
0 answers

GPS lap & Segment timer

I've been searching for a while but haven't found exactly what I'm looking for. I'm working on an app that will go in a race car. It will give the driver the ability to press a button to mark a Start/Finish line. It will also have a button to…
kfrosty
  • 805
  • 1
  • 8
  • 14
0
votes
1 answer

Determining Cross Over of Numbers

Lets say I have this data set... var a = [5,6,7]; var b = [9,8,6]; Imagine that those values were plotted the y in a (x,y) coordinate pair, and the x was the array index, how could I tell if my two arrays had crossed at one point. Thanks.
Jeff
  • 873
  • 2
  • 10
  • 16
0
votes
1 answer

Sql two line intersection

I'm working on a geo project and have some question about that. I draw line with latitude longitude data like the picture below. 1,2,3 are the position I get from db. I want to draw line on that route (A,B are the start and end of the line) and get…
Burak
  • 115
  • 1
  • 2
  • 6
0
votes
0 answers

C++ : Modified Line Segment Intersection

Given N lines (either horizontal or vertical), I need to find total intersection of these line segments as well as intersections per line. My code is as follows : using namespace std; #define x second #define y first #define MAX 10000 typedef…
Buckster
  • 41
  • 12
0
votes
1 answer

How to extend the line of 2 PolyFit from either side to intersect and get a combined fit line

I am trying to get combined fit line made from two linear polyfit from either side (should intersect), here is the picture of fit lines: I am trying to make the two fit (blue) lines intersect and produce a combined fit line as shown in the picture…
0
votes
1 answer

Trying to calculate multiple line intersections using lists of tuples python

EDIT: Git Repo for sample files https://github.com/tpubben/lineIntersect I am trying to calculate the line intersection points in x,y coordinates based on a set of intersecting lines crossing one continuous line made up of multiple segments. The…
haplessgeo
  • 23
  • 4
0
votes
1 answer

inf output computing line slopes

I am very new at C++. I wrote this code below which is supposed to tell me if 2 lines have an intersection point, so I figured two lines with equal "M" in the y=Mx+B equation should not intersect and all others would. The program seems to be…
TStro
  • 11
  • 3
0
votes
1 answer

Central projection on linesegments

I have the following problem. Given are two data sets in 2D space. The two data sets are 2D measurement points from a central point given in the example by (0,0). I need to central project the points of the first data set (x1, y1) on line segments…
bdvd
  • 117
  • 1
  • 1
  • 11
0
votes
0 answers

logic behind the code for finding intersection between two lines

This is part of a code from a user defined function in (fluent-CFD software) to deform the mesh. The comment says it finds the intersection between two lines. My questions are: 1.Does the value t1 and t2 represent the X and Y coordinates of…
0
votes
1 answer

Intersection of two triangles in the plane

The intersection of two triangles is either empty or an n-gon (for n up to 6). In theory, it is easy to come up with an algorithm to compute the intersection area. One can compute the possible intersections of all line segments and combine them with…
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
1 2 3
8 9