Fixed cppcheck warnings
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@486 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
|
|
||||||
CmdOption(const T& _val) : val_(_val), valid_(true) { }
|
CmdOption(const T& _val) : val_(_val), valid_(true), enabled_(false) { }
|
||||||
CmdOption() : valid_(false), enabled_(false) { }
|
CmdOption() : valid_(false), enabled_(false) { }
|
||||||
|
|
||||||
// has been set and has a value
|
// has been set and has a value
|
||||||
@@ -69,10 +69,10 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator T () { return val_; }
|
operator T () const { return val_; }
|
||||||
// operator const T& () const { return val_; }
|
// operator const T& () const { return val_; }
|
||||||
|
|
||||||
operator T* () { return is_valid() ? &val_ : NULL; }
|
operator T* () const { return is_valid() ? &val_ : NULL; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -316,7 +316,6 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
// Left & middle button: zoom in/out
|
// Left & middle button: zoom in/out
|
||||||
|
|
||||||
|
|
||||||
float value_y;
|
|
||||||
Vec3f newPoint3D;
|
Vec3f newPoint3D;
|
||||||
bool newPoint_hitSphere = map_to_sphere( newPoint2D, newPoint3D );
|
bool newPoint_hitSphere = map_to_sphere( newPoint2D, newPoint3D );
|
||||||
|
|
||||||
@@ -336,7 +335,7 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
if ( (_event->buttons() == (LeftButton+MidButton)) ||
|
if ( (_event->buttons() == (LeftButton+MidButton)) ||
|
||||||
(_event->buttons() == LeftButton && _event->modifiers() == ControlModifier))
|
(_event->buttons() == LeftButton && _event->modifiers() == ControlModifier))
|
||||||
{
|
{
|
||||||
value_y = radius_ * dy * 3.0 / h;
|
float value_y = radius_ * dy * 3.0 / h;
|
||||||
translate(Vec3f(0.0, 0.0, value_y));
|
translate(Vec3f(0.0, 0.0, value_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,30 +366,31 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
|
|
||||||
|
|
||||||
// rotate
|
// rotate
|
||||||
else if (_event->buttons() == LeftButton)
|
else if (_event->buttons() == LeftButton) {
|
||||||
{
|
|
||||||
if (last_point_ok_)
|
if (last_point_ok_) {
|
||||||
{
|
if ((newPoint_hitSphere = map_to_sphere(newPoint2D, newPoint3D))) {
|
||||||
if ( (newPoint_hitSphere = map_to_sphere(newPoint2D, newPoint3D)) )
|
Vec3f axis = last_point_3D_ % newPoint3D;
|
||||||
{
|
if (axis.sqrnorm() < 1e-7) {
|
||||||
Vec3f axis = last_point_3D_ % newPoint3D;
|
axis = Vec3f(1, 0, 0);
|
||||||
if (axis.sqrnorm() < 1e-7) {
|
} else {
|
||||||
axis = Vec3f(1,0,0);
|
axis.normalize();
|
||||||
} else {
|
}
|
||||||
axis.normalize();
|
// find the amount of rotation
|
||||||
}
|
Vec3f d = last_point_3D_ - newPoint3D;
|
||||||
// find the amount of rotation
|
float t = 0.5 * d.norm() / TRACKBALL_RADIUS;
|
||||||
Vec3f d = last_point_3D_ - newPoint3D;
|
if (t < -1.0)
|
||||||
float t = 0.5*d.norm()/TRACKBALL_RADIUS;
|
t = -1.0;
|
||||||
if (t<-1.0) t=-1.0;
|
else if (t > 1.0)
|
||||||
else if (t>1.0) t=1.0;
|
t = 1.0;
|
||||||
float phi = 2.0 * asin(t);
|
float phi = 2.0 * asin(t);
|
||||||
float angle = phi * 180.0 / M_PI;
|
float angle = phi * 180.0 / M_PI;
|
||||||
rotate( axis, angle );
|
rotate(axis, angle);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// remember this point
|
// remember this point
|
||||||
last_point_2D_ = newPoint2D;
|
last_point_2D_ = newPoint2D;
|
||||||
|
|||||||
@@ -276,8 +276,6 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
// Middle button: translate object
|
// Middle button: translate object
|
||||||
// Left & middle button: zoom in/out
|
// Left & middle button: zoom in/out
|
||||||
|
|
||||||
|
|
||||||
float value_y;
|
|
||||||
Vec3f newPoint3D;
|
Vec3f newPoint3D;
|
||||||
bool newPoint_hitSphere = map_to_sphere( newPoint2D, newPoint3D );
|
bool newPoint_hitSphere = map_to_sphere( newPoint2D, newPoint3D );
|
||||||
|
|
||||||
@@ -296,7 +294,7 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
// move in z direction
|
// move in z direction
|
||||||
if ( (_event->button() == Qt::LeftButton) && (_event->button() == Qt::MidButton))
|
if ( (_event->button() == Qt::LeftButton) && (_event->button() == Qt::MidButton))
|
||||||
{
|
{
|
||||||
value_y = radius_ * dy * 3.0 / h;
|
float value_y = radius_ * dy * 3.0 / h;
|
||||||
translate(Vec3f(0.0, 0.0, value_y));
|
translate(Vec3f(0.0, 0.0, value_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -703,7 +703,6 @@ open_vd_base_mesh(const char* _filename)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef EXAMPLE_CREATION
|
#ifdef EXAMPLE_CREATION
|
||||||
int tree_id, node_id;
|
|
||||||
|
|
||||||
// load details
|
// load details
|
||||||
for (i=0; i<n_details_; ++i)
|
for (i=0; i<n_details_; ++i)
|
||||||
|
|||||||
@@ -275,7 +275,6 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
// Left & middle button: zoom in/out
|
// Left & middle button: zoom in/out
|
||||||
|
|
||||||
|
|
||||||
float value_y;
|
|
||||||
Vec3f newPoint3D;
|
Vec3f newPoint3D;
|
||||||
bool newPoint_hitSphere = map_to_sphere( newPoint2D, newPoint3D );
|
bool newPoint_hitSphere = map_to_sphere( newPoint2D, newPoint3D );
|
||||||
|
|
||||||
@@ -294,7 +293,7 @@ QGLViewerWidget::mouseMoveEvent( QMouseEvent* _event )
|
|||||||
// move in z direction
|
// move in z direction
|
||||||
if ( (_event->state() & LeftButton) && (_event->state() & MidButton))
|
if ( (_event->state() & LeftButton) && (_event->state() & MidButton))
|
||||||
{
|
{
|
||||||
value_y = radius_ * dy * 3.0 / h;
|
float value_y = radius_ * dy * 3.0 / h;
|
||||||
translate(Vec3f(0.0, 0.0, value_y));
|
translate(Vec3f(0.0, 0.0, value_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user