* Class for representing a direct local frame composed of 3 orthonormal vectors T (tangent), B (bitangent) and N (normal).
* This class can compress/decompress a local frame, switching from its explicit representation (3 vectors) to its compressed representation (1 vector).
...
...
@@ -39,7 +66,7 @@ namespace Utils {
* VEC3 T,B,N ; // current set of orthonormal vectors composing the direct frame.
* LocalFrame<PFP> lf(T,B,N) ; // Constructor from explicit expression.
* if (lf.isOrthoNormalDirect()) // test if the frame is Orthogonal, Normalized and Direct
T(1,0,0),// (T,B,N) can be any orthonormal direct frame
B(0,1,0),// but has to be initialized exactly the same
N(0,0,1)// in every constructor !{
{
// get known data
constREAL&thetaN=compressedFrame[0];
constREAL&phiN=compressedFrame[1];
constREAL&thetaT=compressedFrame[2];
constREAL&theta1=compressedFrame[0];
constREAL&phi=compressedFrame[1];
constREAL&theta2=compressedFrame[2];
// compute phiT
REALphiT=-std::atan((std::cos(thetaN)*std::cos(thetaT)+std::sin(thetaN)*std::sin(thetaT))*std::cos(phiN)/std::sin(phiN));// if quot==0, atan returns Pi/2
phi=std::acos(std::max(std::min(REAL(1.0),N*m_N),REAL(-1.0)));// phi1 is always positive because the direction of vector Tp=N^N1 (around which a rotation of angle phi is done later on) changes depending on the side on which they lay w.r.t eachother.