magnitude向量_magnitudes_unity magnitude

电脑杂谈  发布时间:2017-05-21 05:02:52  来源:网络整理

magnitudes_unity magnitude_magnitude向量

Returns the squared length of this vector (Read Only).

返回这个向量的长度的平方(只读)。

The magnitude of a vector v is calculated as Mathf.Sqrt(Vector3.Dot(v, v)). However, the Sqrt calculation is quite complicated and takes longer to execute than the normal arithmetic operations. Calculating the squared magnitude instead of using the magnitude property is much faster - the calculation is basically the same only without the slow Sqrt call. If you are using magnitudes simply to compare distances, then you can just as well compare squared magnitudes against the squares of distances since the comparison will give the same result.

一个向量V的长度计算方法是Mathf.Sqrt(Vector3.Dot(v, v))。magnitude向量然而,sqrt计算是相当复杂的,需要更长的时间比正常执行算术操作。计算长度平方来代替直接计算长度速度更快,除掉开根号计算是基本相同的。magnitude向量如果你只是使用大小比较的距离,那么你同样可以比较平方长度大小来比较距离,得到相同的结果。


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-48319-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...