Checking if two cubic Bézier curves intersect

前端 未结 8 541
星月不相逢
星月不相逢 2020-12-04 14:42

For a personal project, I\'d need to find out if two cubic Bézier curves intersect. I don\'t need to know where: I just need to know if they do. However, I\'d need to do it

8条回答
  •  温柔的废话
    2020-12-04 15:01

    This is a hard problem. I would split each of the 2 Bezier curves into say 5-10 discrete line segments, and just do line-line intersections.

    enter image description here

    foreach SampledLineSegment line1 in Bezier1
        foreach SampledLineSegment line2 in Bezier2
            if( line1 intersects line2 )
                then Bezier1 intersects Bezier2
    

提交回复
热议问题