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

2D-Visibility/Light - Efficient Polygon-Ray intersection

Im trying to write a game in 2D with Sfml. For that game i need a Lightengine and some code that can give me the area of the world that is visible to the player. AS both problems fit very well together (are pratically the same) i would like to solve…
sro5h
  • 322
  • 2
  • 12
1
vote
0 answers

Two lines segment intersection step by step

I am studying algorithm and math and I came up to "Intersection of two line segment". I searched a good code and explanation about it but with no luck I didn't understand how it works step by step. I read this page and @Gareth explained it well…
Crane
  • 11
  • 4
1
vote
4 answers

Calculate intersection of two lines using integers only

I can quite easily calculate the point of intersection given two lines. If I start with two vertices: (x1,y1) (x2,y2) I can calculate the slope by doing (y1-y2)/(x1-x2), and then calculating the intercept y1 - slope * x1 Then do that again, so I…
BWG
  • 2,238
  • 1
  • 20
  • 32
1
vote
1 answer

R: Find intersection of two vectors

I have two vectors. I need to find the intersection between these two, and do a nice plot of it. So, here is a very simple data frame example: df <- data.frame( id <- c(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2), p…
Thorst
  • 1,590
  • 1
  • 21
  • 35
1
vote
1 answer

On the time complexity of line segment intersection reporting

According to D. M. Mount, the optimal algorithm for line segment intersection reporting problem (monochromatic case) is O(nlogn + k) but for red-blue intersection reporting problem is O(n^4/3 log^O(1) n + k). The apparent reason behind the…
justin waugh
  • 885
  • 3
  • 12
  • 22
1
vote
1 answer

Find intersection of two lines given a constant slope and changing coordinates

I asked this question earlier but didn't communicated it clearly, so forgive me for the duplicate. This should be better. I need to figure the position of a coordinate, given three other coordinates and 2 slopes. Basically, the intersection point…
oooyaya
  • 1,773
  • 1
  • 15
  • 39
1
vote
1 answer

Three.js mouseover mesh with ray intersection, no reaction

I'm trying to set up a website that runs in a single WebGL element. I'm trying to get it to tell when the mouse is over an object. I'm using a couple of planes with a with transparent textures on them as links, but it won't pick up on any…
jctjct3
  • 263
  • 1
  • 6
  • 17
1
vote
0 answers

How to identify point if two gesture stroke intersect

I am developing a game. In my game, when two gesture lines intersect, the game will be over. How can I identify the point intersection of two gesture lines? My code is below public class GameActivity extends Activity implements OnTouchListener { …
Ketan Patel
  • 2,155
  • 19
  • 27
1
vote
0 answers

How to know if two lines intersects in ZedGraph?

I am using ZedGraph to draw graphs in C#. I have been asked to draw a parabole and a "normal" line in the same graph, and I need to know programatically if the parabole and the line intersect at any point (actually, I have to know that AND if one…
Roman
  • 1,691
  • 4
  • 18
  • 35
1
vote
0 answers

intersectioncalculation not working

I am doing a game for a schoolproject that will use a calculation for seing if two lines intersects. I am not very good at the math behind calculating intersections but I have found a couple of examples on how it works, on this site for example. But…
bajen micke
  • 309
  • 1
  • 7
  • 18
0
votes
2 answers

Line intersections

Im writing an application that will calculate the focal length of a camera based on the lines that can be seen in the photograph. For instance, if you take a picture of a room, the ceiling line can be one straight line (horizontal), the floor can be…
heyred
  • 2,031
  • 8
  • 44
  • 89
0
votes
1 answer

Line2D.Double telling me lines are intersecting when they don't

In making a project for class, we are defining shapes (triangle, quadrilateral, pentagon) without the help of the Shape class obviously. In my checks to make sure the shape is valid, I use Line2D.Double linesIntersect() to determine if the…
0
votes
1 answer

Matlab:output vector giving the x and y values of point of intersection

How do I write a function having 3 inputs (2 vectors consisting of coefficients[a b c] and vector of x values) of two line equations of form ax+by=c that outputs a vector giving x and y values of the point of intersection. Example: solveSystem([1 -1…
0
votes
3 answers

Large deviation of latitude values for calculating the point of intersection of arcs on a sphere

My task is to find the intersection point of two arcs on the sphere (if it exists). I used algorithm from http://www.boeing-727.com/Data/fly%20odds/distance.html but in some cases the latitude deviation is too large. What could be causing this? I…
0
votes
0 answers

Turf js lineIntersect and graphic intersection of two lineStrings are not same

I'm trying to draw intersection point of two lines, but visually it is not correct intersection point. Is there any idea? I'm using openlayers as map. // draw two lines on the map: const lineFeature1 = new ol.Feature({ geometry: new…
1 2 3
8 9