Code documentation & information ?

Code documentation & information ?

Bild des Benutzers Polar01

Hi,

I'm currently discovering the Embree code and have a few questions, because there is no documentation on some functions:

1) signmsk
2) xorf
3)  rcp

BTW, if I understand, in the file "triangle1v_intersector_pluecker".h there is the following code :

const float sgnDet = signmsk(det);
const float U = xorf(dot(cross(v2+v0,e0),D),sgnDet); 

Is it equivalent to : const float U = copysign(dot(cross(v2+v0,e0),D), det);

Thanks

http://spectralbattle.wordpress.com/
4 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Sven Woop (Intel)

1) signmask takes a floating point number and and sets every bit to zero, except for the sign bit (topmost bit).

2) xorf simply calculates a bitwise xor of the bit representation of two floating point numbers

The mask returned by signmask can be used to efficiently flip the sign bit of another floating point number by using the xorf instruction.For instance xorf(signmask(-6),10) = -10. The intersection algorithm uses a sequence like this to flip some signs if the triangle is hit from the back.

3) rcp calculates the reciprocal of a floating point number, rcp(x) = 1/x

Bild des Benutzers Sven Woop (Intel)

The sequence does not copy the sign, but flip the sign of dot(cross(v2+v0,e0),D) if det < 0

Bild des Benutzers Polar01

Thanks,

Yes, I see... ingenious :-)

http://spectralbattle.wordpress.com/

Melden Sie sich an, um einen Kommentar zu hinterlassen.