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
2
votes
2 answers

Intersection of two line segments in Python

Different articles have discussed about the intersection of two line segments in Python such as How do I compute the intersection point of two lines?, Numpy and line intersections, How can I check if two segments intersect? But, no one made it…
Javad.Rad
  • 93
  • 1
  • 8
2
votes
2 answers

How to calculate the intersection point between an infinite line and a line segment?

Basically, a function that fulfills this signature: function getLineIntersection(vec2 p0, vec2 direction, vec2 p2, vec2 p3) { // return a vec2 } I have looked around at existing solutions, and they all seem to deal with how to find the…
Ryan Peschel
  • 11,087
  • 19
  • 74
  • 136
2
votes
1 answer

Finding every point of intersection of multiple lines using pygame in python for creation of game board

I need to find every point of intersection of lines in my code. At these points, I want to put my game pieces. The logic of the game is like that of tic tac toe in which if a player places 3 same color marbles in a row he/she can grab a piece of the…
shyckh
  • 57
  • 8
2
votes
2 answers

Line - Circle intersection test in 3d world?

i have a 3d world where i have several 2d circles laying on the ground facing to the sky. how can i check if a line will intersect one of those circles frop top-to-down? i tried to search but all i get is this kind of intersection…
Rookie
  • 3,753
  • 5
  • 33
  • 33
2
votes
1 answer

Finding line intersect using Cramer's rule - Getting incorrect y coordinate

I'm looking to find the intersect of 2 lines using Cramer's rule. This is for an exercise from the book An Introduction To Java Programming (Exercise 3.25 from Chapter 3 and 8.31 from Chapter 8. They are both basically the same idea just the one…
Sruly
  • 169
  • 1
  • 13
2
votes
1 answer

How to find intersection point of opposite lines of two lines

I am trying to find intersection point of opposite lines of two lines: var ax=0.00, ay=0.50 ; var bx=1.00, by=1.00 ; var cx=2.00, cy=0.25 ; But I am very confused about finding an opposite of a line. Here is a jsfiddle which points are converted…
Digerkam
  • 1,826
  • 4
  • 24
  • 39
2
votes
1 answer

Using shapely to return co ordinates of multilinestring that intersect

I've generated random streets using Shapely's LineString function using the following code: class StreetNetwork(): def __init__(self): self.street_coords = [] self.coords = {} def gen_street_coords(self, length, coordRange): min_, max_…
Jack
  • 394
  • 1
  • 15
2
votes
1 answer

Finding intersections of curves that cannot be represented as y=f(x)

I have two pairs of data sets, x1 vs y1 and x2 vs y2. x1, y1, x2, y2 all have uneven distribution of data represented by the following images: My problem is to determine the intersection of the two pairs of data sets, x1/y1 and x2/y2, shown in…
2
votes
2 answers

Counting the intersection points (lines) of two sets of sequences

I have to find an algorithm that can find the total amount of intersections between two sets of arrays, whereas one of the array is sorted. An example, we have these two arrays and we draw straight lines towards corresponding number. These two…
Jozo
  • 115
  • 1
  • 7
2
votes
2 answers

Need to find the intersection point of two line segments iterated over multiple segments

OK, here is the problem. I am trying to calculate the intersection of two lines by comparing multiple line segments that are read out of a series of csv files. I've already got the x,y coordinate pairs for each line segment into a list of tuples…
haplessgeo
  • 23
  • 4
2
votes
0 answers

Intersection points between a long list of segments

I'm writing a Matlab program that has to do the following thing I'm stuck with. I have a file containing the names of two points on every line (the points have its respective coordinates in the space). Let's say the segments are airways and the…
2
votes
2 answers

libGdx: Intersector.intersectLines (seems to) returns wrong result?

if (points.size() >= 3) { for (int i = 1; i <= points.size() - 1; i++) { if (Intersector.intersectLines(points.get(0), points.get(1), points.get(i), points.get(i + 1), null)) return true; } } return false; I cant find my error with…
TheRyco
  • 31
  • 2
2
votes
1 answer

Determine if two lines intersect

I've seen many postings here on stackoverflow, which are discussing this topic. I took a solution from stackoverflow, but I couldn't find the posting. It was to say: If two lines are intersecting, then the crossproduct produces for the left and the…
Irgendw Pointer
  • 1,770
  • 3
  • 30
  • 67
2
votes
4 answers

How to find intersection points between two cubic bezier curve

I have two cubic bezier curve, curve 1:- 1st anchor-point(a1x,a1y), 1st control-point(c1x,c1y), 2nd control-point(c2x,c2y), 2nd anchor-point(a2x,a2y) curve 2:- 1st anchor-point(a3x,a3y), 1st control-point(c2x,c3y), 2nd control-point(c4x,c4y), 2nd…
Scarecrow
  • 4,057
  • 3
  • 30
  • 56
1
vote
0 answers

QGIS Line Intersections Plugin does not create a point to some intersection lines

When I use the line intersection plugin in Qgis, it doesn't create whole intersect points. Also, the gif and picture below show that the lines intersect but the plugin doesn't assign any point to them. How can I solve the problem?
1 2
3
8 9