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
1
vote
0 answers

How to find intersection of lines with opencv

In this picture, I try to fin intersection points between the long white lines between racing lanes and the short perpendicular ones So to automaticaly obtain the black points as materialized below enter image description here Here is my…
1
vote
1 answer

Intersection of hyperbolae in R based on line equations

I am trying to find a method for finding the point of intersection of 2 hyperbolae in R. Single-branch hyperbloae can be described by the following equation: or where (xi, yi) and (xj, yj) are the coordinates of 2 foci (i and j), and r is the…
hugh-allan
  • 1,170
  • 5
  • 16
1
vote
2 answers

How do I determine if a series of points (or polygon) is within a rectangular region?

I have been looking at posts about determining if a point lies within a polygon or not and the answers are either too vague, abstract, or complex for me. So I am going to try to ask my question specific to what I need to do. I have a set of points…
1
vote
2 answers

How to check if two user-drawn (squiggly) lines intersect?

I'm thinking of making an online version of the game Sprouts, possibly using the JavaScript web browser graphics library p5.js You can read more about it but basically there are 2 players that draw lines with their mouse between points. The lines…
user10408316
1
vote
2 answers

Why do we need to homogenise these vectors?

I was looking for a solution for finding the intersection point of two lines. I am aware that this can be done by finding their vector product. I stumbled upon this example here: Numpy and line intersections def get_intersect(a1, a2, b1, b2): …
Shibalicious
  • 288
  • 2
  • 4
  • 14
1
vote
0 answers

Sweep-line algorithm with circle intersections

I'm trying to implement the sweep line algorithm for circle intersections in which an intersection occurs iff the euclidean distance between the circles' origins are <= the sum of both radii. (excluding circles within circles) I reduced my problem…
1
vote
1 answer

Linear expression for intersection length of two lines in 1D

Given the first line from a to b where a < b and the second line from x to y where x < y, how do you calculate the intersection length of those two? Example: a =0, b=5, x=3, y=7 012345 |----| |---| 34567 the result would be 2 since they…
Isitar
  • 1,286
  • 12
  • 29
1
vote
1 answer

How to move line segments to eliminate intersections with minimum movements?

Is there any algorithm or related work for the following problem? Given a set of line segments in 2D, how to move line segments (horizontally or vertically) to eliminate intersections so as to minimize the overall movements? Intersections at…
Mirian
  • 11
  • 1
1
vote
4 answers

Calculation of shape width at given horizontal line

Let's say I have such a polygon public partial class Window2 : Window { public Window2() { InitializeComponent(); var myPolygon = new Polygon(); myPolygon.Stroke = Brushes.Black; myPolygon.Fill =…
codeDom
  • 1,623
  • 18
  • 54
1
vote
1 answer

what is an good way to define a bounded plane to make line intersections easy?

I want to define a bounded plane, ie a rectangle in 3d space. I realize it could be defined just by declaring its 4 vertices, but I will be using a line intersection algorithm many times on this shape so I want the definition to be somewhat useful…
Theo Walton
  • 1,085
  • 9
  • 24
1
vote
0 answers

How to untangle graph as much as possible?

I wrote a short directed graph viewer that generates random nodes and random directed relationships between nodes and presents them on screen. The nodes are currently positioned sequentially as a grid, and as one can notice, there's a lot of line…
MathuSum Mut
  • 2,765
  • 3
  • 27
  • 59
1
vote
1 answer

Planarity Model for intersecting lines

I'm looking at the Planarity model's "crossed?" method from the Models Library in order to determine if two lines are intersecting. This model seems to be working for the most part; however, there is one issue that I think I found. I don't have the…
mattsap
  • 3,790
  • 1
  • 15
  • 36
1
vote
0 answers

Ray-wall intersection

I'm writing a simple 2D game engine because I want to brush up my school math knowledge. I know that maybe a lot of people already answered similar questions (I read a lot of questions and answers about this topic), but I can't manage why my method…
user3101803
  • 35
  • 1
  • 7
1
vote
1 answer

Accuracy of line intersection with vertical line

I am calculating the intersection point of two lines with the following function: // Functions of lines as per requested: // f(y1) = starty1 + x * d1 // f(y2) = starty2 + x * d2 // x1 and y1 are the coordinates of the first point // x2 and y2 are…
RobotRock
  • 4,211
  • 6
  • 46
  • 86
1
vote
2 answers

Trying to find if a line intersects with another, but it is failing even when the lines do intersect

At the start of my program I draw six straight vertical line segments, and then after I randomly draw as many line segments as the user wants. Every time it is drawn, I check if it does intersect one of those six segments. The problem is, even if…
FyreeW
  • 395
  • 1
  • 5
  • 18
1 2 3
8 9