Skip to content

Commit

Permalink
handle 2d centering
Browse files Browse the repository at this point in the history
  • Loading branch information
alecjacobson committed Jun 20, 2021
1 parent b5d4d9b commit f0657f9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions include/igl/opengl/glfw/Viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,13 +667,11 @@ namespace glfw


// Initialization code for the trackball
Eigen::RowVector3d center;
if (data().V.rows() == 0)
Eigen::RowVector3d center = Eigen::RowVector3d(0,0,0);
if(data().V.rows() > 0)
{
center << 0,0,0;
}else
{
center = data().V.colwise().sum()/data().V.rows();
// be careful that V may be 2D
center.head(data().V.cols()) = data().V.colwise().sum()/data().V.rows();
}

Eigen::Vector3f coord =
Expand Down

0 comments on commit f0657f9

Please sign in to comment.