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

Tips for calculating, if a dot is on a curved line and if 2 curved lines intersects

I’d like to program a game in processing (Java) in which the player draws a possibly curved line and next makes a dot on this line. I think, I would draw the line only with pixels, not lines oder bezier-curves and maybe store the drawn pixels in an…
Ingo
  • 1
  • 1
0
votes
0 answers

Line intersection turtle script not working as it should

I am creating a script that visualises (or is supposed to) the most amount of intersections given an amount of lines using turtle in python. For some reason, the part of the code that is supposed to highlight all of the crossovers only highlights a…
0
votes
1 answer

How does the line-intersection routine in the Greiner-Hormann algorithm work?

As a part of the Greiner-Hormann algorithm for polygon-clipping (described here), there is this subroutine: In image form: And transcribed (attempted): intersect(P1,P2,Q1,Q2,alphaP,alphaQ) WEC_P1 = WEC_P2 =
NicknEma
  • 414
  • 3
  • 13
0
votes
1 answer

Check if two lines are intersecting? (if so, not where so)

I saw this asked but I couldn't understand the answers! I got 4 vector2s, P1 & P2 for line 1, P3 & P4 for line 2. Code for intersection position works, but how do I check if that intersection is happening? More specifically, I want to check what…
weg
  • 27
  • 3
0
votes
0 answers

python vtk: vtkCellLocator IntersectWithLine Overloads Not Implemented

I have an unstructured grid that I need to intersect with a line to find both the points and cells. The VTK documentation for vtkCellLocator has an overloaded version of IntersectWithLine that will do this, but it is not implemented in python? Any…
Adam
  • 37
  • 5
0
votes
0 answers

3d line intersection with plane

I have two points in my world, P0 and P1 (xyz,..) which basically represent the start of my line and the end of my line. I also have a plane/side with 4 points, ABCD (xyz,..). What I want to do is send a "ray" (in this case a line) through the plane…
yoranus
  • 45
  • 4
0
votes
0 answers

Calculation of large numbers C++11

I'm trying to find the point where 2 lines intersect. I am using this example on geeks for geeks. This works well for small numbers. I am using "accurate" latitude and longitude points which are scaled by 10000000. So a latitude of 40.4381311 would…
av4625
  • 303
  • 1
  • 11
0
votes
1 answer

How do I fix this JS function so it doesn't return false positives when checking if two line segments intersect?

I'm working on a mapping project (with the Google Maps SDK). Before drawing a line segment on the map I check to see if it intersects with any existing lines. I'm experiencing a situation where the code below is reporting the line segments are…
0
votes
1 answer

Find intersection of 2 layers containing multiple lines (in python)

I have 2 layers with links and nodes: layer A (yellow) and layer B (blue). I would like to get the places where the lines of layer A intersect with the lines of layer B (red nodes), directly in python. I have the coordinates for all nodes in both…
fschuch
  • 27
  • 1
  • 3
0
votes
0 answers

How to attribute intersection points between poly and lineseg to poly

I'm trying to plot an animal's trajectory from a set of coordinates as a line segment. I want to see how many coordinates are plotted inside a circular zone vs outside. I think that coordinates which intersect with the circle are being counted as…
lara202
  • 11
  • 1
0
votes
1 answer

How to find intersection point between circle and line(2 points) using Mapbox(Turf)

I'm finding how to find intersection point between circle and line(2 points) using Mapbox(Turf). Turfjs provides "intersect" function but Turf in java doesn't provide that function. I wonder how to calculate intersection point(longitude and…
0
votes
3 answers

How to get the angle or vector perpendicular to the bounce angle for 3 points?

I am trying to find the vector or angle in order to calculate the points where two "thick" lines would intersect. The end goal is to draw simple flat planes for a thick line renderer. Although I'm using Unity and am working with Vector3, for my…
jpwrunyan
  • 530
  • 5
  • 22
0
votes
1 answer

R plotting a line at the intersection of two lines

I have this simple code that plots two intersecting lines: x <- c(1,2,3,4,5,6) y2 <- c(6,5,4,3,2,1) y1 <- c(1,2,3,4,5,6) plot(x, y1) plot(x, y1, type="o", col="blue", pch="o", lty=1) points(x, y2, col="red", pch="*") lines(x, y2, col="red",…
maurobio
  • 1,480
  • 4
  • 27
  • 38
0
votes
1 answer

Efficient algorithm for minimum trace of several line segments

What is the most efficient algorithm for generating a set of line segments that represent the minimum of a group of line segments (see image)? The resulting line segments should have following properties: Do not overlap Each segment must fall…
Darko
  • 589
  • 1
  • 7
  • 18
0
votes
1 answer

Is there any way to draw lines on screen by swiping and check whether they are crossing each other

We have a situation in which user will be drawing many lines on the screen and we need to find out the crossing lines and get intersection point. Is there any way to achieve this in iPhone using cocoa-touch ? Please show a direction and if possible…
Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
1 2 3
8 9