本文介绍了近似逆三角函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在只有以下数学工具的环境中实现asin,acos和atan:

I have to implement asin, acos and atan in environment where I have only following math tools:

  • 正弦波
  • 余弦
  • 基本定点算法(不提供浮点数)

我也已经具有相当好的平方根函数.

I also already have reasonably good square root function.

我可以使用它们来实现合理有效的逆三角函数吗?

我不需要太大的精度(无论如何,浮点数的精度都非常有限),基本近似就可以了.

I don't need too big precision (the floating point numbers have very limited precision anyways), basic approximation will do.

我已经半数决定使用表查找,但是我想知道是否有一些更整洁的选择(不需要花几百行代码即可实现基本数学).

I'm already half decided to go with table lookup, but I would like to know if there is some neater option (that doesn't need several hundred lines of code just to implement basic math).

要清除这些问题:我需要以每秒35帧的速度每帧运行数百次该功能.

To clear things up: I need to run the function hundreds of times per frame at 35 frames per second.

推荐答案

arcsin(x)函数是否需要较大的精度?如果否,则可以在N个节点中计算arcsin,并将值保留在内存中.我建议使用行近似.如果x = A*x_(N) + (1-A)*x_(N+1),则x = A*arcsin(x_(N)) + (1-A)*arcsin(x_(N+1))其中arcsin(x_(N))是已知的.

Do you need a large precision for arcsin(x) function? If no you may calculate arcsin in N nodes, and keep values in memory. I suggest using line aproximation. if x = A*x_(N) + (1-A)*x_(N+1) then x = A*arcsin(x_(N)) + (1-A)*arcsin(x_(N+1)) where arcsin(x_(N)) is known.

这篇关于近似逆三角函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-06 12:49