**diff options**

author | Akarsh Simha <akarsh@kde.org> | 2016-09-28 07:39:27 (GMT) |
---|---|---|

committer | Akarsh Simha <akarsh@kde.org> | 2016-09-29 02:20:27 (GMT) |

commit | c1dc0b46e51424ffcc11b0cdf822852381442556 (patch) | |

tree | fa6be6d8041b1e6ff1bf057d2ec3fc09fc16f6c7 | |

parent | d9158d4d986b29da2950a402612f01a919480fc6 (diff) |

Update comments in SkyPoint::precess()

Rotation matrices are most efficient, even though access time is long
See:
https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Performance_comparisons
Applying a rotation matrix, which costs 9 multiplications, is more
efficient than applying a quaternion on a vector. The only issue is
the overhead of accessing 9 double precision elements.
It looks like it is best to stick to rotation matrices.

-rw-r--r-- | kstars/skyobjects/skypoint.cpp | 10 |

1 files changed, 5 insertions, 5 deletions

diff --git a/kstars/skyobjects/skypoint.cpp b/kstars/skyobjects/skypoint.cpp index 4f810f2..65f3d13 100644 --- a/kstars/skyobjects/skypoint.cpp +++ b/kstars/skyobjects/skypoint.cpp @@ -200,12 +200,12 @@ void SkyPoint::precess( const KSNumbers *num ) { s[1] = sinRA0*cosDec0; s[2] = sinDec0; - // FIXME: 1. We should be using eigen / better algorithms for - // matrix multiplication - // According to callgrind, the call KSNumbers::p2( int, int ), - // which is repeated 9 times per precess, has a similar cycle cost - // as atan2(), so this could be important to fix! + // NOTE: Rotation matrices are the fastest way to do rotations on + // a vector. Quaternions need more multiplications. The rotation + // matrix compensates in some sense by having more 'precomputed' + // multiplications. The matrix elements seem to cache nicely, so + // there isn't much overhead in accessing them. //Multiply P2 and s to get v, the vector representing the new coords. // for ( unsigned int i=0; i<3; ++i ) { |