Bug when inverting embree::OrthonormalSpace3f ?

Bug when inverting embree::OrthonormalSpace3f ?

Hi,

I think I found a bug.
When calculating the inverse of an instance of embree::OrthonormalSpace3f via rcp(..) the resulting translation is wrong. I tracked down the problem to line 86 in common/math/affinespace.h:

  template<typename L> __forceinline AffineSpaceT<L>        rcp( const AffineSpaceT<L>& a ) { L il = rcp(a.l); return AffineSpaceT<L>(il,-il*a.p); }

Because of operator precedence, "-"  is evaluated before "*". It makes no difference for rotation matrices but makes problems for quaternions (negating them does not change orientation). So rather do

  template<typename L> __forceinline AffineSpaceT<L>        rcp( const AffineSpaceT<L>& a ) { L il = rcp(a.l); return AffineSpaceT<L>(il,-(il*a.p)); }

Can anybody confirm this?

Best,

clemens

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I think you are right, that is a bug. I just committed the fix.

Leave a Comment

Please sign in to add a comment. Not a member? Join today