Code documentation & information ?

Code documentation & information ?


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);

4 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

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

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


Yes, I see... ingenious :-)

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi