Pre-calculate sqrt?

59 views
Skip to first unread message

the ether

unread,
May 18, 2013, 10:18:30 AM5/18/13
to accels...@googlegroups.com
I've seen on this forum that calls to setAcceleration() are considered to be expensive because of the use of the square root function in internal calculations. My application will attempt to do several real-time tasks concurrently and so I am concerned about this issue. Could we have a way of pre-calculating the relevant sqrt values? I will have several pre-known accelerations that my application will use so there shouldn't be a need for real-time calculations; I could pre-calculate.

I see that the class has a private member, _sqrt_twoa. Could we perhaps change that to be a protected member or provide some other way of making necessary precalculations so that acceleration rates can be changed in a less expensive way please?
Reply all
Reply to author
Forward
0 new messages