[数学] 游戏数学:多项式实作快速弦波&根号

楼主: cjcat2266 (CJ Cat)   2014-02-28 10:50:09
最近真是发狠写了一堆文啊...XD
正弦(sine)和余弦(cosine)
是两个游戏逻辑常常用到的函式
然而它们的效能往往不佳
本文示范如何使用之前介绍的多项式近似技巧
实作比std::sin和std::cos快的版本
(在我的电脑上测试约是3.5倍快)
http://allenchou.net/2014/02/game-math-faster-sine-cosine/
[追加]
本技巧也可用来近似 1/sqrt(x)
用来快速re-normalize长度接近一的向量
http://allenchou.net/2014/02/game-math-fast-re-normalization-of-unit-vectors/
系列文目录 http://allenchou.net/game-math-series/
作者: azureblaze (AzureBlaze)   2014-02-28 18:48:00
http://ppt.cc/GaXj 不知道跟这个比起来如何?
楼主: cjcat2266 (CJ Cat)   2014-03-01 06:34:00
在我的机器上测试结果是一样快,两者都比sqrt快约1.25xCarmack's rsqrt 的优势已不如从前现在很多的FPU都有sqrt instruction了

Links booklink

Contact Us: admin [ a t ] ucptt.com