Commit 7600ff1a authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

debug abs / fabs ..

parent 6065ae86
...@@ -11,5 +11,5 @@ schnapps.linkViewAndPlugin(v.getName(), renderPlugin.getName()); ...@@ -11,5 +11,5 @@ schnapps.linkViewAndPlugin(v.getName(), renderPlugin.getName());
schnapps.linkViewAndPlugin(v.getName(), renderVectorPlugin.getName()); schnapps.linkViewAndPlugin(v.getName(), renderVectorPlugin.getName());
schnapps.linkViewAndMap(v.getName(), obj.getName()); schnapps.linkViewAndMap(v.getName(), obj.getName());
#differentialPropertiesPlugin.computeNormal(obj.getName()); differentialPropertiesPlugin.computeNormal(obj.getName());
#differentialPropertiesPlugin.computeCurvature(obj.getName()); differentialPropertiesPlugin.computeCurvature(obj.getName());
...@@ -1207,16 +1207,16 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1207,16 +1207,16 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
REAL err = 0 ; REAL err = 0 ;
// REAL norm_deviation_1 = REAL(1) / abs(norm * normal[v1]) ; // REAL norm_deviation_1 = REAL(1) / fabs(norm * normal[v1]) ;
// REAL norm_deviation_2 = REAL(1) / abs(norm * normal[v2]) ; // REAL norm_deviation_2 = REAL(1) / fabs(norm * normal[v2]) ;
// err += norm_deviation_1 + norm_deviation_2 ; // err += norm_deviation_1 + norm_deviation_2 ;
REAL mCurv_deviation_1 = abs(mCurv - (kmax[v1] + kmin[v1] / REAL(2))) ; REAL mCurv_deviation_1 = fabs(mCurv - (kmax[v1] + kmin[v1] / REAL(2))) ;
REAL mCurv_deviation_2 = abs(mCurv - (kmax[v2] + kmin[v2] / REAL(2))) ; REAL mCurv_deviation_2 = fabs(mCurv - (kmax[v2] + kmin[v2] / REAL(2))) ;
err += mCurv_deviation_1 + mCurv_deviation_2 ; err += mCurv_deviation_1 + mCurv_deviation_2 ;
// REAL cDir1_deviation_1 = REAL(1) / abs(cDir1 * Kmax[v1]) ; // REAL cDir1_deviation_1 = REAL(1) / fabs(cDir1 * Kmax[v1]) ;
// REAL cDir1_deviation_2 = REAL(1) / abs(cDir1 * Kmax[v2]) ; // REAL cDir1_deviation_2 = REAL(1) / fabs(cDir1 * Kmax[v2]) ;
// err += cDir1_deviation_1 + cDir1_deviation_2 ; // err += cDir1_deviation_1 + cDir1_deviation_2 ;
einfo.it = edges.insert(std::make_pair(err, d)) ; einfo.it = edges.insert(std::make_pair(err, d)) ;
...@@ -1440,7 +1440,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1440,7 +1440,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tens1),Eigen::EigenvaluesOnly); Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tens1),Eigen::EigenvaluesOnly);
const VEC3& e_val = Utils::convertRef<VEC3>(solver.eigenvalues()); const VEC3& e_val = Utils::convertRef<VEC3>(solver.eigenvalues());
REAL err = std::max(std::max(abs(e_val[0]), abs(e_val[1])) , abs(e_val[2])) ; REAL err = std::max(std::max(fabs(e_val[0]), fabs(e_val[1])) , fabs(e_val[2])) ;
// if (v1 % 5000 == 0) CGoGNout << e_val << CGoGNendl << err << CGoGNendl ; // if (v1 % 5000 == 0) CGoGNout << e_val << CGoGNendl << err << CGoGNendl ;
......
...@@ -148,8 +148,8 @@ void Approximator_HemiFuncCoefs<PFP>::approximate(Dart d) ...@@ -148,8 +148,8 @@ void Approximator_HemiFuncCoefs<PFP>::approximate(Dart d)
const VEC3& N1 = m_frameN[d] ; const VEC3& N1 = m_frameN[d] ;
const VEC3& N2 = m_frameN[dd] ; const VEC3& N2 = m_frameN[dd] ;
//assert(abs(T * N1) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the first tangent plane") ; //assert(fabs(T * N1) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the first tangent plane") ;
//assert(abs(T * N2) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the second tangent plane") ; //assert(fabs(T * N2) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the second tangent plane") ;
// Compute D1' and D2' // Compute D1' and D2'
VEC3 B1prime = N1 ^ T ; VEC3 B1prime = N1 ^ T ;
...@@ -327,8 +327,8 @@ void Approximator_HemiFuncCoefsHalfEdge<PFP>::approximate(Dart d) ...@@ -327,8 +327,8 @@ void Approximator_HemiFuncCoefsHalfEdge<PFP>::approximate(Dart d)
const VEC3& N1 = m_frameN[d] ; const VEC3& N1 = m_frameN[d] ;
const VEC3& N2 = m_frameN[dd] ; const VEC3& N2 = m_frameN[dd] ;
//assert(abs(T * N1) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the first tangent plane") ; //assert(fabs(T * N1) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the first tangent plane") ;
//assert(abs(T * N2) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the second tangent plane") ; //assert(fabs(T * N2) < 1e-6 || !"Approximator_FrameInterpolation<PFP>::approximate: T is not located in the second tangent plane") ;
// Compute D1' and D2' // Compute D1' and D2'
VEC3 B1prime = N1 ^ T ; VEC3 B1prime = N1 ^ T ;
......
...@@ -537,8 +537,8 @@ void normalCycles_SortAndSetEigenComponents( ...@@ -537,8 +537,8 @@ void normalCycles_SortAndSetEigenComponents(
{ {
// sort eigen components : ev[inormal] has minimal absolute value ; kmin = ev[imin] <= ev[imax] = kmax // sort eigen components : ev[inormal] has minimal absolute value ; kmin = ev[imin] <= ev[imax] = kmax
int inormal=0, imin, imax ; int inormal=0, imin, imax ;
if (abs(e_val[1]) < abs(e_val[inormal])) inormal = 1; if (fabs(e_val[1]) < fabs(e_val[inormal])) inormal = 1;
if (abs(e_val[2]) < abs(e_val[inormal])) inormal = 2; if (fabs(e_val[2]) < fabs(e_val[inormal])) inormal = 2;
imin = (inormal + 1) % 3; imin = (inormal + 1) % 3;
imax = (inormal + 2) % 3; imax = (inormal + 2) % 3;
if (e_val[imax] < e_val[imin]) { int tmp = imin ; imin = imax ; imax = tmp ; } if (e_val[imax] < e_val[imin]) { int tmp = imin ; imin = imax ; imax = tmp ; }
...@@ -578,8 +578,8 @@ void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsi ...@@ -578,8 +578,8 @@ void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsi
// switch kmin and kmax w.r.t. Kmin and Kmax // switch kmin and kmax w.r.t. Kmin and Kmax
int inormal=0, imin, imax ; int inormal=0, imin, imax ;
if (abs(e_val[1]) < abs(e_val[inormal])) inormal = 1; if (fabs(e_val[1]) < fabs(e_val[inormal])) inormal = 1;
if (abs(e_val[2]) < abs(e_val[inormal])) inormal = 2; if (fabs(e_val[2]) < fabs(e_val[inormal])) inormal = 2;
imin = (inormal + 1) % 3; imin = (inormal + 1) % 3;
imax = (inormal + 2) % 3; imax = (inormal + 2) % 3;
if (e_val[imax] < e_val[imin]) { int tmp = imin ; imin = imax ; imax = tmp ; } if (e_val[imax] < e_val[imin]) { int tmp = imin ; imin = imax ; imax = tmp ; }
......
...@@ -321,14 +321,14 @@ void ridgeLines( ...@@ -321,14 +321,14 @@ void ridgeLines(
if( (e1 < 0 && e2 > 0) || (e1 > 0 && e2 < 0) ) if( (e1 < 0 && e2 > 0) || (e1 > 0 && e2 < 0) )
{ {
REAL alpha = abs(e1) / ( abs(e1) + abs(e2) ) ; REAL alpha = fabs(e1) / ( fabs(e1) + fabs(e2) ) ;
ridge_segments[d].p1.d = v1 ; ridge_segments[d].p1.d = v1 ;
ridge_segments[d].p1.w = alpha ; ridge_segments[d].p1.w = alpha ;
p1set = true ; p1set = true ;
} }
if( (e2 < 0 && e3 > 0) || (e2 > 0 && e3 < 0) ) if( (e2 < 0 && e3 > 0) || (e2 > 0 && e3 < 0) )
{ {
REAL alpha = abs(e2) / ( abs(e2) + abs(e3) ) ; REAL alpha = fabs(e2) / ( fabs(e2) + fabs(e3) ) ;
if(!p1set) if(!p1set)
{ {
ridge_segments[d].p1.d = v2 ; ridge_segments[d].p1.d = v2 ;
...@@ -345,7 +345,7 @@ void ridgeLines( ...@@ -345,7 +345,7 @@ void ridgeLines(
} }
if( (e3 < 0 && e1 > 0) || (e3 > 0 && e1 < 0) ) if( (e3 < 0 && e1 > 0) || (e3 > 0 && e1 < 0) )
{ {
REAL alpha = abs(e3) / ( abs(e1) + abs(e3) ) ; REAL alpha = fabs(e3) / ( fabs(e1) + fabs(e3) ) ;
if(p1set && !p2set) if(p1set && !p2set)
{ {
ridge_segments[d].p2.d = v3 ; ridge_segments[d].p2.d = v3 ;
......
...@@ -729,7 +729,7 @@ float Image<DataType>::computeCurvatureCount3(const DataType *ptrVox, const std: ...@@ -729,7 +729,7 @@ float Image<DataType>::computeCurvatureCount3(const DataType *ptrVox, const std:
// return (valY + valZ)/2.0f; // return (valY + valZ)/2.0f;
unsigned short m1,m2; unsigned short m1,m2;
if ((abs(vals[0]) < abs(vals[1])) && (abs(vals[0]) < abs(vals[2]))) if ((fabs(vals[0]) < fabs(vals[1])) && (fabs(vals[0]) < fabs(vals[2])))
{ {
m1 =1; m1 =1;
m2 =2; m2 =2;
...@@ -737,7 +737,7 @@ float Image<DataType>::computeCurvatureCount3(const DataType *ptrVox, const std: ...@@ -737,7 +737,7 @@ float Image<DataType>::computeCurvatureCount3(const DataType *ptrVox, const std:
else else
{ {
m1=0; m1=0;
if (abs(vals[1]) < abs(vals[2])) if (fabs(vals[1]) < fabs(vals[2]))
m2 = 2; m2 = 2;
else else
m2 = 1; m2 = 1;
...@@ -753,7 +753,7 @@ float Image<DataType>::computeCurvatureCount3(const DataType *ptrVox, const std: ...@@ -753,7 +753,7 @@ float Image<DataType>::computeCurvatureCount3(const DataType *ptrVox, const std:
if ((vals[m2] - vals[m1])>0.8f) if ((vals[m2] - vals[m1])>0.8f)
return 1.0f; return 1.0f;
return std::max(std::max(abs(vals[0]),abs(vals[1])),abs(vals[2])); return std::max(std::max(fabs(vals[0]),fabs(vals[1])),fabs(vals[2]));
} }
......
...@@ -117,7 +117,7 @@ void Plane3D<T>::project(Vector<3,T>& p) const ...@@ -117,7 +117,7 @@ void Plane3D<T>::project(Vector<3,T>& p) const
{ {
#define PRECISION 1e-10 #define PRECISION 1e-10
T d = -distance(p) ; T d = -distance(p) ;
if(std::abs(d) > PRECISION) if(fabs(d) > PRECISION)
{ {
Vector<3,T> v = m_normal * d ; Vector<3,T> v = m_normal * d ;
p += v ; p += v ;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
namespace CGoGN namespace CGoGN
{ {
namespace Utils namespace Utils
{ {
...@@ -70,7 +71,6 @@ FrameManipulator::FrameManipulator(): ...@@ -70,7 +71,6 @@ FrameManipulator::FrameManipulator():
points.reserve(6*nb_segments+30); points.reserve(6*nb_segments+30);
points.resize(6*nb_segments+6); points.resize(6*nb_segments+6);
unsigned int second = 2*(nb_segments+1); unsigned int second = 2*(nb_segments+1);
unsigned int third = 4*(nb_segments+1); unsigned int third = 4*(nb_segments+1);
...@@ -90,7 +90,6 @@ FrameManipulator::FrameManipulator(): ...@@ -90,7 +90,6 @@ FrameManipulator::FrameManipulator():
points[third + 2*i+1] = Geom::Vec3f(xx,yy,0.0f); points[third + 2*i+1] = Geom::Vec3f(xx,yy,0.0f);
} }
points.push_back(Geom::Vec3f(0.0f,0.0f,0.0f)); points.push_back(Geom::Vec3f(0.0f,0.0f,0.0f));
points.push_back(Geom::Vec3f(0.23f,0.0f,0.0f)); points.push_back(Geom::Vec3f(0.23f,0.0f,0.0f));
...@@ -118,7 +117,6 @@ FrameManipulator::FrameManipulator(): ...@@ -118,7 +117,6 @@ FrameManipulator::FrameManipulator():
points.push_back(Geom::Vec3f(-0.03f,0.7f, 0.0f)); points.push_back(Geom::Vec3f(-0.03f,0.7f, 0.0f));
points.push_back(Geom::Vec3f(0.0f, 0.7f, 0.03f)); points.push_back(Geom::Vec3f(0.0f, 0.7f, 0.03f));
points.push_back(Geom::Vec3f(0.0f,0.0f, 0.27f)); points.push_back(Geom::Vec3f(0.0f,0.0f, 0.27f));
points.push_back(Geom::Vec3f(0.0f,0.0f, 0.75f)); points.push_back(Geom::Vec3f(0.0f,0.0f, 0.75f));
points.push_back(Geom::Vec3f(0.0f,0.0f, 0.9f)); points.push_back(Geom::Vec3f(0.0f,0.0f, 0.9f));
...@@ -128,7 +126,6 @@ FrameManipulator::FrameManipulator(): ...@@ -128,7 +126,6 @@ FrameManipulator::FrameManipulator():
points.push_back(Geom::Vec3f(0.0f,-0.03f,0.7f)); points.push_back(Geom::Vec3f(0.0f,-0.03f,0.7f));
points.push_back(Geom::Vec3f(0.03f,0.0f, 0.7f)); points.push_back(Geom::Vec3f(0.03f,0.0f, 0.7f));
m_vboPos->bind(); m_vboPos->bind();
glBufferData(GL_ARRAY_BUFFER, points.size() * sizeof(Geom::Vec3f), &(points[0]), GL_STREAM_DRAW); glBufferData(GL_ARRAY_BUFFER, points.size() * sizeof(Geom::Vec3f), &(points[0]), GL_STREAM_DRAW);
...@@ -153,7 +150,6 @@ float FrameManipulator::getSize() ...@@ -153,7 +150,6 @@ float FrameManipulator::getSize()
return m_scaleRendering; return m_scaleRendering;
} }
void FrameManipulator::draw() void FrameManipulator::draw()
{ {
Utils::GLSLShader::pushTransfo(); Utils::GLSLShader::pushTransfo();
...@@ -163,7 +159,6 @@ void FrameManipulator::draw() ...@@ -163,7 +159,6 @@ void FrameManipulator::draw()
glPushAttrib(GL_LINE_BIT); glPushAttrib(GL_LINE_BIT);
m_shader->enableVertexAttribs(); m_shader->enableVertexAttribs();
if (!m_locked_axis[Xr]) if (!m_locked_axis[Xr])
{ {
if (m_highlighted == Xr) if (m_highlighted == Xr)
...@@ -203,53 +198,53 @@ void FrameManipulator::draw() ...@@ -203,53 +198,53 @@ void FrameManipulator::draw()
} }
else else
{ {
if (!m_locked_axis[Xs]) if (!m_locked_axis[Xs])
{
if (m_highlighted == Xs)
{
glLineWidth(6.0f);
m_shader->setColor(Geom::Vec4f(1.0f,1.0f,0.0f,0.0f));
}
else
{ {
glLineWidth(3.0f); if (m_highlighted == Xs)
m_shader->setColor(Geom::Vec4f(1.0f,0.0f,0.0f,0.0f)); {
glLineWidth(6.0f);
m_shader->setColor(Geom::Vec4f(1.0f,1.0f,0.0f,0.0f));
}
else
{
glLineWidth(3.0f);
m_shader->setColor(Geom::Vec4f(1.0f,0.0f,0.0f,0.0f));
}
m_shader->bind();
glDrawArrays(GL_LINES, 6*nb_segments+6, 2);
} }
m_shader->bind();
glDrawArrays(GL_LINES, 6*nb_segments+6, 2);
}
if (!m_locked_axis[Ys]) if (!m_locked_axis[Ys])
{
if (m_highlighted == Ys)
{
glLineWidth(6.0f);
m_shader->setColor(Geom::Vec4f(1.0f,1.0f,0.0f,0.0f));
}
else
{ {
glLineWidth(3.0f); if (m_highlighted == Ys)
m_shader->setColor(Geom::Vec4f(0.0f,0.7f,0.0f,0.0f)); {
glLineWidth(6.0f);
m_shader->setColor(Geom::Vec4f(1.0f,1.0f,0.0f,0.0f));
}
else
{
glLineWidth(3.0f);
m_shader->setColor(Geom::Vec4f(0.0f,0.7f,0.0f,0.0f));
}
m_shader->bind();
glDrawArrays(GL_LINES, 6*nb_segments+8, 2);
} }
m_shader->bind();
glDrawArrays(GL_LINES, 6*nb_segments+8, 2);
}
if (!m_locked_axis[Zs]) if (!m_locked_axis[Zs])
{
if (m_highlighted == Zs)
{ {
glLineWidth(6.0f); if (m_highlighted == Zs)
m_shader->setColor(Geom::Vec4f(1.0f,1.0f,0.0f,0.0f)); {
} glLineWidth(6.0f);
else m_shader->setColor(Geom::Vec4f(1.0f,1.0f,0.0f,0.0f));
{ }
glLineWidth(3.0f); else
m_shader->setColor(Geom::Vec4f(0.0f,0.0f,0.7f,0.0f)); {
glLineWidth(3.0f);
m_shader->setColor(Geom::Vec4f(0.0f,0.0f,0.7f,0.0f));
}
m_shader->bind();
glDrawArrays(GL_LINES, 6*nb_segments+10, 2);
} }
m_shader->bind();
glDrawArrays(GL_LINES, 6*nb_segments+10, 2);
}
} }
...@@ -305,7 +300,6 @@ void FrameManipulator::draw() ...@@ -305,7 +300,6 @@ void FrameManipulator::draw()
glDrawArrays(GL_TRIANGLE_FAN, 6*nb_segments+30, 6); glDrawArrays(GL_TRIANGLE_FAN, 6*nb_segments+30, 6);
} }
m_shader->disableVertexAttribs(); m_shader->disableVertexAttribs();
glPopAttrib(); glPopAttrib();
...@@ -314,8 +308,6 @@ void FrameManipulator::draw() ...@@ -314,8 +308,6 @@ void FrameManipulator::draw()
m_shader->unbind(); m_shader->unbind();
} }
void FrameManipulator::highlight(unsigned int axis) void FrameManipulator::highlight(unsigned int axis)
{ {
if (m_highlighted == axis) if (m_highlighted == axis)
...@@ -324,8 +316,6 @@ void FrameManipulator::highlight(unsigned int axis) ...@@ -324,8 +316,6 @@ void FrameManipulator::highlight(unsigned int axis)
m_highlighted = axis; m_highlighted = axis;
} }
unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV, float epsilon) unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV, float epsilon)
{ {
Geom::Vec3f P,V; Geom::Vec3f P,V;
...@@ -429,7 +419,6 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV ...@@ -429,7 +419,6 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV
} }
} }
if (axisPickable(Yt) || axisPickable(Ys)) if (axisPickable(Yt) || axisPickable(Ys))
{ {
Geom::Vec3f PY(0.0f,3.6f*m_lengthAxes[1],0.0f); Geom::Vec3f PY(0.0f,3.6f*m_lengthAxes[1],0.0f);
...@@ -448,7 +437,6 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV ...@@ -448,7 +437,6 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV
} }
} }
if (axisPickable(Zt) || axisPickable(Zs)) if (axisPickable(Zt) || axisPickable(Zs))
{ {
Geom::Vec3f PZ(0.0f,0.0f,3.6f*m_lengthAxes[2]); Geom::Vec3f PZ(0.0f,0.0f,3.6f*m_lengthAxes[2]);
...@@ -489,7 +477,6 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV ...@@ -489,7 +477,6 @@ unsigned int FrameManipulator::pick(const Geom::Vec3f& PP, const Geom::Vec3f& VV
return NONE; return NONE;
} }
void FrameManipulator::rotate(unsigned int axis, float angle) void FrameManipulator::rotate(unsigned int axis, float angle)
{ {
// create axis // create axis
...@@ -498,16 +485,13 @@ void FrameManipulator::rotate(unsigned int axis, float angle) ...@@ -498,16 +485,13 @@ void FrameManipulator::rotate(unsigned int axis, float angle)
glm::mat4 tr = glm::rotate(glm::mat4(1.0f),angle,ax); glm::mat4 tr = glm::rotate(glm::mat4(1.0f),angle,ax);
m_rotations = m_rotations*tr; m_rotations = m_rotations*tr;
} }
void FrameManipulator::translate(unsigned int axis, float x) void FrameManipulator::translate(unsigned int axis, float x)
{ {
m_trans += x*m_scaleRendering * glm::vec3(m_rotations[axis-Xt][0],m_rotations[axis-Xt][1],m_rotations[axis-Xt][2]); m_trans += x*m_scaleRendering * glm::vec3(m_rotations[axis-Xt][0],m_rotations[axis-Xt][1],m_rotations[axis-Xt][2]);
} }
void FrameManipulator::setLengthAxes() void FrameManipulator::setLengthAxes()
{ {
float avgScale =(m_scale[0]+m_scale[1]+m_scale[2])/3.0f; float avgScale =(m_scale[0]+m_scale[1]+m_scale[2])/3.0f;
...@@ -519,7 +503,6 @@ void FrameManipulator::setLengthAxes() ...@@ -519,7 +503,6 @@ void FrameManipulator::setLengthAxes()
float sc1 = m_scale[1]/avgScale; float sc1 = m_scale[1]/avgScale;
float sc2 = m_scale[2]/avgScale; float sc2 = m_scale[2]/avgScale;
positions[ind] = 0.23f*sc0; positions[ind] = 0.23f*sc0;
ind+=7; ind+=7;
positions[ind] = 0.23f*sc1; positions[ind] = 0.23f*sc1;
...@@ -591,10 +574,8 @@ void FrameManipulator::setLengthAxes() ...@@ -591,10 +574,8 @@ void FrameManipulator::setLengthAxes()
m_vboPos->releasePtr(); m_vboPos->releasePtr();
m_lengthAxes = Geom::Vec3f(0.25f*sc0, 0.25f*sc1, 0.25f*sc2); m_lengthAxes = Geom::Vec3f(0.25f*sc0, 0.25f*sc1, 0.25f*sc2);
} }
void FrameManipulator::scale(unsigned int axis, float sc) void FrameManipulator::scale(unsigned int axis, float sc)
{ {
if (axis==CENTER) if (axis==CENTER)
...@@ -607,10 +588,8 @@ void FrameManipulator::scale(unsigned int axis, float sc) ...@@ -607,10 +588,8 @@ void FrameManipulator::scale(unsigned int axis, float sc)
m_scale[axis-Xs] *= sc; m_scale[axis-Xs] *= sc;
setLengthAxes(); setLengthAxes();
} }
glm::mat4 FrameManipulator::transfoRenderFrame() glm::mat4 FrameManipulator::transfoRenderFrame()
{ {
glm::mat4 tr = glm::translate(glm::mat4(1.0f), m_trans); glm::mat4 tr = glm::translate(glm::mat4(1.0f), m_trans);
...@@ -628,7 +607,6 @@ glm::mat4 FrameManipulator::transfo() ...@@ -628,7 +607,6 @@ glm::mat4 FrameManipulator::transfo()
return glm::scale(tr,glm::vec3(m_scale[0],m_scale[1],m_scale[2])); return glm::scale(tr,glm::vec3(m_scale[0],m_scale[1],m_scale[2]));
} }
void FrameManipulator::setTranslation(const Geom::Vec3f& P) void FrameManipulator::setTranslation(const Geom::Vec3f& P)
{ {
m_trans[0] = P[0]; m_trans[0] = P[0];
...@@ -636,8 +614,6 @@ void FrameManipulator::setTranslation(const Geom::Vec3f& P) ...@@ -636,8 +614,6 @@ void FrameManipulator::setTranslation(const Geom::Vec3f& P)
m_trans[2] = P[2]; m_trans[2] = P[2];
} }
void FrameManipulator::setScale(const Geom::Vec3f& S) void FrameManipulator::setScale(const Geom::Vec3f& S)
{ {
m_scale[0] = S[0]; m_scale[0] = S[0];
...@@ -647,7 +623,6 @@ void FrameManipulator::setScale(const Geom::Vec3f& S) ...@@ -647,7 +623,6 @@ void FrameManipulator::setScale(const Geom::Vec3f& S)
setLengthAxes(); setLengthAxes();
} }
bool FrameManipulator::setOrientation(const Geom::Vec3f& X, const Geom::Vec3f& Y) bool FrameManipulator::setOrientation(const Geom::Vec3f& X, const Geom::Vec3f& Y)
{ {
Geom::Vec3f Z = X^Y; Geom::Vec3f Z = X^Y;
...@@ -670,10 +645,8 @@ bool FrameManipulator::setOrientation(const Geom::Vec3f& X, const Geom::Vec3f& Y ...@@ -670,10 +645,8 @@ bool FrameManipulator::setOrientation(const Geom::Vec3f& X, const Geom::Vec3f& Y
return true; return true;
} }
void FrameManipulator::setTransformation( const glm::mat4& transfo) void FrameManipulator::setTransformation( const glm::mat4& transfo)
{ {
setTranslation(Geom::Vec3f(transfo[3][0],transfo[3][1],transfo[3][2])); setTranslation(Geom::Vec3f(transfo[3][0],transfo[3][1],transfo[3][2]));