Ask Your Question

Revision history [back]

How to find intersection point and the distance for ray line segment intersection in OpenCV?

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.

image description

What I want is 1. point X, which is the point where line A ray intersect with line B 2. distance between X and A1 or A2(either one is fine).

When testing for intersection, line A ray should not 1. intersect with line segment D 2. intersect with line segment C

How do I do this?

How to find intersection point and the distance for ray line segment intersection in OpenCV?

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.

image description

What I want is

1.
  1. point X, which is the point where line A ray intersect with line B 2. B
  2. distance between X and A1 or A2(either one is fine).

When testing for intersection, line A ray should not 1. not

  1. intersect with line segment D 2. D
  2. intersect with line segment C

How do I do this?