块状和直线相交 [英] Numpy and line intersections

查看:98
本文介绍了块状和直线相交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用numpy计算两条线段之间的交点?

How would I use numpy to calculate the intersection between two line segments?

在代码中,我有segment1 =((x1,y1),(x2,y2))和segment2 =((x1,y1),(x2,y2)).注意段1不等于段2.因此,在我的代码中,我还一直在计算斜率和y截距,如果可以避免,那将是很好的选择,但我不知道该怎么做.

In the code I have segment1 = ((x1,y1),(x2,y2)) and segment2 = ((x1,y1),(x2,y2)). Note segment 1 does not equal segment2. So in my code I've also been calculating the slope and y-intercept, it would be nice if that could be avoided but I don't know of a way how.

我一直在使用Cramer规则和我在Python中编写的函数,但我想找到一种更快的方法.

I've been using Cramer's rule with a function I wrote up in Python but I'd like to find a faster way of doing this.

推荐答案

直接从 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆