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
5
votes
1 answer

How to get line rectangle intersection segment?

I want to find weight matrix for Algebraic reconstruction method. For this I have to find the line intersection with grid. I can find direct line intersection with line but I have to store the intersected line segment grid number wise. So suppose if…
4
votes
4 answers

Finding intersections of a skeletonised image in python opencv

I have a skeletonised image (shown below). I would like to get the intersections of the lines. I have tried the following method below, skeleton is a openCV image and the algorithm returns a list of coordinates: def…
James Paterson
  • 2,652
  • 3
  • 27
  • 40
3
votes
1 answer

HTML5 Canvas - lines self-intersection with alpha-channel

Please look at the picture (sorry, new users can't insert an image directly into post). Lines are drawn semi-transparent colors (alpha = 0.5). When the red line crosses itself, the double overlay translucent colors does not occur. At the same time,…
dom1n1k
  • 31
  • 2
3
votes
1 answer

Recursive Ray Traversal Algorithm - Traverse k-d Tree

I have chosen a stack based traversal algorithm (Recursive Ray Traversal Algorithm), and I am having a little trouble understanding it. Here is what I understand. I need to find a point where the ray enters the voxel (then calculate the distance ray…
3
votes
1 answer

Simple line-plane intersection on a fixed z-axis?

What is, and is there, a fast way to check where in the plane my line will intersect, if i know the plane is always in the same z-axis (so it cannot be rotated), and its width/height is infinite? Also, my "line" isn't actually a line, but a 3d…
Rookie
  • 3,753
  • 5
  • 33
  • 33
3
votes
1 answer

How to calculate ray-line segment intersection preferably in OpenCV? And get its intersection points and distance from origin?

I have 4 lines segment, A, B, C and D. Each line is represented as two points. Eg. line A is represented as point A1 and point A2. What I want is point X, which is the point where line A ray intersect with line B distance between X and…
Syaiful Nizam Yahya
  • 4,196
  • 11
  • 51
  • 71
3
votes
1 answer

Detect if two line segments intersect using Cramer

I have used the code that has been posted here. Here is the code again: from __future__ import division def line(p1, p2): A = (p1[1] - p2[1]) B = (p2[0] - p1[0]) C = (p1[0]*p2[1] - p2[0]*p1[1]) return A, B, -C def intersection(L1,…
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
3
votes
1 answer

Lines intersection using Boost Geometry

How line can be represented using Boost Geometry? I don't need finite segment, but I need infinite lines (maybe Segment or Linestring can be extended?) As I understand I can use boost::geometry::intersects, but I don't know how to define infinite…
mrgloom
  • 20,061
  • 36
  • 171
  • 301
3
votes
0 answers

Bentley-Ottmann algorithm for any segments

I've implemented the Bentley-Ottmann algorithm and also handled the edge cases mentioned here: http://en.wikipedia.org/wiki/Bentley%E2%80%93Ottmann_algorithm#Special_position_and_numerical_precision_issues. However, it still doesn't work with all…
3
votes
1 answer

Boost intersection two line segments in 3D

I try to use boost geometry to calculate intersection of two line segments in 3D. Here is piece of code: typedef boost::geometry::model::point boost3dPoint; typedef…
H'H
  • 1,638
  • 1
  • 15
  • 39
3
votes
1 answer

C#: 2D sub-Tile Line intersection

I have some problems getting an algorithm for my game to work and hope someone here can help me. Google didn't seem to be a good help as most solutions just work for full tiles. In the game units can occupy different positions inside a tile, i.e.…
user253984
3
votes
0 answers

Fast line segment intersection

To find all intersections of many line segments one can check every possible pair in O(n^2) for an intersection. There is also the well-known Bentley-Ottmann_algorithm which uses sweep line approach to run more efficiently. Are there any others,…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
3
votes
1 answer

Detetcting intersection between 2 line in webcam feed opencv

i'm trying to detect the intersection between two line in webcam feed. Here's the screenshot of what i already have I try to find the intersection between my red and green line. And here's the code of what i already have #include…
Kevin phytagoras
  • 123
  • 1
  • 2
  • 15
3
votes
2 answers

I have a line from the center point of a circle to another point. I want to find the point where the line intersects the circumference of the circle

I have tried several different solutions but no luck so far. - (CGPoint)contractLineTemp:(CGPoint)point :(CGPoint)circle :(float)circleRadius { CGFloat x,y; x = point.x - circle.x; y = point.y - circle.y; CGFloat theta = atan2(x, y); CGPoint…
cugrz
  • 53
  • 3
3
votes
2 answers

Detecting intersecting lines after a hough transform

Using Hough transform in Matlab,detected some lines. Using the end points of these lines I have plotted them. I cant understand how I can find intersecting lines when I have all the variables. Line7 Point1 [50,66] Point2 [11,106] theta,rho…
user349026
1
2
3
8 9