- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
找到从由两点定义的直线到一个点的距离得到了很好的回答,Shortest distance between a point and a line segment .在那个答案中 http://paulbourke.net/geometry/pointlineplane/说明了线 P1、P2 与点 P3 相切,显示了如何确定到该点的距离。这是一个 GPS 应用程序,所以线的航向已经确定,我不想使用点斜率公式或截取它的限制。
我想确定切线与 P1 P2 定义的 P3 的那条线相交的点。提前谢谢你。
编辑:
我有一个解决方案,但它有点麻烦,但也许不是,它确实有效:
1) Calculate distance to point by 2 point line to P3 but don't take abs value
2) If distance < 0 then side = 1 else side = -1
3) dist = abs(distance)
4) rad2 = heading + PI/2 * side //tangent is always 90 degrees to line
5) sin rad2*dist + P3.x = point Q.x
6) cos rad2*dist + P3.y = point Q.y
无论点在哪一边似乎都有效
最佳答案
如果一条线由方程 A*x+B*y+C=0
已知,并且点 P 位于坐标为 ( P_x,P_y)
然后 在线 最接近 P 的点是
x = (A^2*P_y-A*B*P_x-B*C)/(A^2+B^2)
y = (B^2*P_x-A*B*P_y-A*C)/(A^2+B^2)
另外点P到直线的最小距离是
d = ABS(A*P_x+B*P_y+C)/SQRT(A^2+B^2)
编辑 1
通过两点 (x_1,y_1)
和 (x_2,y_2)
的无限直线方程为
A*x+B*x+C=0
(y_1-y_2)*x + (x_2-x_1)*y + (x_1*y_2-x_2*y_1) = 0
编辑2
如果直线从点(Q_x,Q_y)
和方向(e_x,e_y)
给出,则方程系数为
A = -e_y
B = e_x
C = Q_x*e_y - Q_y*e_x
关于c# - 根据与该线相切的第三点在线上找到点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38704246/
我正在制作一个应用程序来计算距离和面积,现在问题是我制作了一个数组并在其中附加了我的节点。 func calculate () { let start = dotNodes[0] le
在我的 Eclipse 上,双分隔符使用逗号而不是点,我想将其更改为逗号,但我不知道如何更改。代码本身如下: double latitudeBerlin = 52.51217; double long
我想知道,如果: string name_a; string name_b; 将有一些已经存在的函数可以让我比较两个字符串的一定数量的字符like strncmp() ,但来 self 的 strin
我在 X 轴上有点,我想从每个点到另一个点 (X2,Y2) 做直线。 此代码适用于从 Y=35 到 X 点 (P) 的蓝线,并且它有效 pos_fixed = np.array([0, TR]) li
我必须返回以度为单位的角度,它应该在 0 到 360(含)之间的范围内。我必须使用 math.h 库中的函数 acos()、asin() 和 atan()。在我的说明中,它说根据该点所在的象限,计算可
请考虑以下说明我的问题的简化示例: 主窗口.xaml 主窗口.xaml.cs using System; using System.Windows; using System.Windo
我是一名优秀的程序员,十分优秀!