Commit 90e70ff1 authored by Kenneth Vanhoey's avatar Kenneth Vanhoey

adapted comments in localFrame and import2tablesSurface::importPlyPTM and...

adapted comments in localFrame and import2tablesSurface::importPlyPTM and secured localFrame (no more possibility of generating a zero vector)
parent 0e79b446
...@@ -674,9 +674,8 @@ bool MeshTablesSurface<PFP>::importPlyPTMgeneric(const std::string& filename, st ...@@ -674,9 +674,8 @@ bool MeshTablesSurface<PFP>::importPlyPTMgeneric(const std::string& filename, st
* @param attrNames : reference that will be filled with the attribute names ; * @param attrNames : reference that will be filled with the attribute names ;
* - 1 attrName for geometric position (VEC3) * - 1 attrName for geometric position (VEC3)
* - 3 attrNames for local frame (3xVEC3) : Tangent, Bitangent and Normal vector * - 3 attrNames for local frame (3xVEC3) : Tangent, Bitangent and Normal vector
* - 6 attrNames for the function coefficients (6xVEC3) : 6 RGB coefficients being successively the constants, the linears (v then u) and the quadratics : a0 + a1*v + a2*u + a3*u*v + a4*v^2 + a5*u^2. * - 6 attrNames for the function coefficients (6xVEC3) : 6 RGB coefficients being successively the quadratic members, the linears and the constants (u then v) : a*u^2 + b*v^2 + c*uv + d*u + e*v +f.
* @return bool : success. * @return bool : success.
* @return bool : success.
*/ */
template <typename PFP> template <typename PFP>
bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames)
......
...@@ -179,9 +179,18 @@ public: // methods ...@@ -179,9 +179,18 @@ public: // methods
} ; } ;
private : // private constants private : // private constants
const VEC3 T ; // (T,B,N) can be any orthonormal direct frame
const VEC3 B ; // zeros are not recommended since they can
const VEC3 N ; // generate zero vectors after a dot product
static const REAL Tx = 0.267261 ;
static const REAL Ty = 0.534522 ;
static const REAL Tz = 0.801784 ;
static const REAL Bx = 0.844416 ;
static const REAL By = -0.530776 ;
static const REAL Bz = 0.0723785 ;
static const REAL Nx = 0.464255 ;
static const REAL Ny = 0.657695 ;
static const REAL Nz = -0.593215 ;
} ; } ;
} // Utils } // Utils
......
...@@ -28,10 +28,7 @@ namespace CGoGN { ...@@ -28,10 +28,7 @@ namespace CGoGN {
namespace Utils { namespace Utils {
template<typename PFP> template<typename PFP>
LocalFrame<PFP>::LocalFrame(const VEC3& T, const VEC3& B, const VEC3& N) : LocalFrame<PFP>::LocalFrame(const VEC3& T, const VEC3& B, const VEC3& N)
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 !
{ {
m_T = T ; m_T = T ;
m_B = B ; m_B = B ;
...@@ -39,11 +36,11 @@ LocalFrame<PFP>::LocalFrame(const VEC3& T, const VEC3& B, const VEC3& N) : ...@@ -39,11 +36,11 @@ LocalFrame<PFP>::LocalFrame(const VEC3& T, const VEC3& B, const VEC3& N) :
} }
template<typename PFP> template<typename PFP>
LocalFrame<PFP>::LocalFrame(const VEC3& compressedFrame) : LocalFrame<PFP>::LocalFrame(const VEC3& compressedFrame)
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 !{
{ {
const VEC3 T(Tx,Ty,Tz) ;
const VEC3 N(Nx,Ny,Nz) ;
// get known data // get known data
const REAL& theta1 = compressedFrame[0] ; const REAL& theta1 = compressedFrame[0] ;
const REAL& phi = compressedFrame[1] ; const REAL& phi = compressedFrame[1] ;
...@@ -60,6 +57,10 @@ typename Geom::Vector<3,typename PFP::REAL> LocalFrame<PFP>::getCompressed() con ...@@ -60,6 +57,10 @@ typename Geom::Vector<3,typename PFP::REAL> LocalFrame<PFP>::getCompressed() con
{ {
VEC3 res ; VEC3 res ;
const VEC3 T(Tx,Ty,Tz) ;
const VEC3 B(Bx,By,Bz) ;
const VEC3 N(Nx,Ny,Nz) ;
REAL& theta1 = res[0] ; REAL& theta1 = res[0] ;
REAL& phi = res[1] ; REAL& phi = res[1] ;
REAL& theta2 = res[2] ; REAL& theta2 = res[2] ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment