如何求向量的倒数?
我正在使用 C# 工作,我正在尝试找出如何获取矢量速度的倒数。
我尝试过:
Vector2 Velocity;
Vector2 Reciprocal = 1 / Velocity;
但我不能这样做,因为我不能采用 int 并将其除以向量。我试图寻找这个问题的答案,但我的表现并不好......
I am working in C# and I am trying to figure out how to take the reciprocal of the vector velocity.
I tried:
Vector2 Velocity;
Vector2 Reciprocal = 1 / Velocity;
But I cannot do this because I cannot take an int and divide it by a vector. I have tried to look for an answer to this, but I have not fared well...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从数学上来说,向量的倒数没有明确定义。您可以取向量大小的倒数,并且可以创建一个新向量,其分量是原始向量分量的倒数,但向量本身的倒数的概念不是没有意义。
根据您要执行的操作,代码会有所不同。
Mathematically speaking, the reciprocal of a vector is not well-defined. You can take the reciprocal of the magnitude of a vector, and you can create a new vector whose components are the reciprocals of the components of the original vector, but the notion of the reciprocal of a vector itself isn't meaningful.
Depending on which operation you want to do, the code will be different.