什么是公式指向已知的起点,终点和距离 [英] whats the formula to point along line known starting point, ending point and distance

查看:156
本文介绍了什么是公式指向已知的起点,终点和距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个问题要找到线上点的x,y,z。我有开始和结束行的posint。如何根据距离计算线上(起点和终点之间)的任何点?示例图像如下。谢谢。

i have a question to find the x,y,z of point on the line. i have start and end posint of line. how to calculate any point on the line(between start and end points) by distance? an example image are bellow. Thanks.



推荐答案

我很确定有更好的方法来做到这一点。 =)

Create a normal and multiply it. I'm pretty sure there are better ways to do that though. =)

Vec3 BA = B - A;
BA.normalize(); // you have the direction
Vec3 Dist = BA.mult(distance);
Vec3 Result = A + Dist;

这篇关于什么是公式指向已知的起点,终点和距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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