如何使用另外两个点及其角度找到第三个点
I found an answer here, but can't understand how to transfer the math to Objective C
I have two points and I also have the angle relative to the axes. How do I find a third point which will form a straight line? The distance should be variable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我正在使用的代码:
This is the code that I am using:
假设我有两个点 pointA 和 pointB。由两点 m 形成的直线的斜率是:
第三点 pointC 与直线上的点 A 的距离为 d,由下式给出:
pointC 现在始终位于沿直线与点 A 的距离 d 处,
从A点到B点的方向。通过 startAtB 获得 pointC
沿距 B 点的直线距离 d,方向为
A点到B点。
在对 calculatPointOnLine 的调用中交换 piintA 和 pointB 的顺序
计算沿线距离 d 的点 C
PointB,从B点到A点的方向。
您可以使用这两个函数来计算直线上的第三个点。
如果这对您有帮助,感谢您接受这个答案。
Let's say I have two points pointA and pointB. The slope of the line formed by the two points m is:
A third point pointC a distance d from pointA on the line would be given by:
pointC will now always lie a distance d along the line from pointA,
in the direction from pointA to pointB. Pass startAtB to have pointC
lie a distance d along the line from pointB, in the direction from
pointA to pointB.
Exchange the order of piintA and pointB in the call to calculatPointOnLine
to calculate a pointC which lies a distance d along the line from
PointB, in the direction from pointB to pointA.
You can use these two functions to calculate a third point on the line.
Thanks for accepting this answer if this helps you.