检查 android.graphics.path 与其自身的交集
我想检查路径是否与自身相交(如果是,则碰撞在(x,y) - 只是为了突出显示)。 我如何检查一条路径是否与另一条路径相交也非常有趣。 这是一个屏幕截图,可以更好地解释我的意思:
I'd like to check if (and if yes, where the collission is(x,y) - just for highlighting) a path does intersect itself.
It would also be very interesting how i do check if a path does intersect with another path.
Here is a screenshot to better explain what i mean:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法是检查任何线段是否与任何其他线段相交。线段由路径中的成对相邻点组成。具有 10 个点的路径有 9 条线段。
下面是一个如何实现这一点的示例。
请参阅如何检测两条线段相交的位置? 有关如何实现 lineSegmentsIntersect 函数的示例。
The simplest way is to check if any line segment intersects with any other line segment. A line segment is made up of pairs of adjacent points in the path. A path with 10 points has 9 line segments.
Here's an example of how one might go about that.
See How do you detect where two line segments intersect? for an example of how to implement the lineSegmentsIntersect function.