The intersection of a curved line segment and a straight line segment

I want to know the intersection point of a curve and a straight line as shown in the picture above.
However, I know that the curve drawn in three.js is made up of many vertices and is drawn in an illusion like a curve.
How can I find the intersection point in this case?

As an option, check intersection of that straight line against all the line segments that form the curve.

Terrible option
Iā€™d leave it as a last resort.

Well, you can write your own implementation of finding the intersection of a line against different types of curve (line, arc, bezier, catmull-rom etc.), which highly likely will be more performant, thus, way complex (but the tougher the challenge, the more fun :slight_smile: ).

2 Likes