Commit a6712e85 authored by Jan Möbius's avatar Jan Möbius
Browse files

- Don't show statistics on non existing entities.

refs #1
parent 555215e0
......@@ -419,19 +419,31 @@ void InfoMeshObjectPlugin::printMeshInfo( MeshT* _mesh , int _id, unsigned int _
sumV += valence;
}
//valence
//=============================
// Vertex valence
//=============================
info_->valenceMin->setText( QString::number(minV) );
info_->valenceMean->setText( QString::number( sumV / (float)_mesh->n_vertices(),'f' ) );
info_->valenceMax->setText( QString::number(maxV) );
//edge length
//=============================
// edge length
//=============================
if (_mesh->n_edges() >0 ) {
info_->edgeMin->setText( QString::number(minE,'f') );
info_->edgeMean->setText( QString::number( sumE / (_mesh->n_edges()*2),'f' ) );
info_->edgeMax->setText( QString::number(maxE,'f') );
} else {
info_->edgeMin->setText( "-" );
info_->edgeMean->setText( "-" );
info_->edgeMax->setText( "-" );
}
//get aspect ratio
//=============================
// Triangle information
//=============================
if (_mesh->n_faces() > 0 ) {
typename MeshT::FaceIter f_it;
typename MeshT::FaceIter f_end = _mesh->faces_end();
......@@ -511,16 +523,15 @@ void InfoMeshObjectPlugin::printMeshInfo( MeshT* _mesh , int _id, unsigned int _
info_->aspectMean->setText( QString::number( sumA / _mesh->n_faces(),'f' ) );
info_->aspectMax->setText( QString::number(maxA,'f') );
info_->angleMin->setText( QString::number(minI,'f') );
info_->angleMean->setText( "-" );
info_->angleMax->setText( QString::number(maxI,'f') );
info_->faceValenceMin->setText(trUtf8("%1").arg(minFValence));
info_->faceValenceMax->setText(trUtf8("%1").arg(maxFValence));
info_->faceValenceMean->setText(trUtf8("%1").arg(
static_cast<float>(sumFValence) / _mesh->n_faces()));
info_->faceValenceMean->setText(trUtf8("%1").arg( static_cast<float>(sumFValence) / _mesh->n_faces()));
// Only one face or no face -> don't output angles
if ( _mesh->n_faces() > 1 ) {
info_->dihedralMin->setText( QString::number(minD,'f') );
info_->dihedralMean->setText( QString::number( sumD / numD,'f' ) );
......@@ -530,6 +541,27 @@ void InfoMeshObjectPlugin::printMeshInfo( MeshT* _mesh , int _id, unsigned int _
info_->dihedralMean->setText( "-" );
info_->dihedralMax->setText( "-" );
}
} else {
// No triangles, no info
info_->aspectMin->setText( "-" );
info_->aspectMean->setText( "-" );
info_->aspectMax->setText( "-" );
info_->angleMin->setText( "-" );
info_->angleMean->setText( "-" );
info_->angleMax->setText( "-" );
info_->faceValenceMin->setText("-");
info_->faceValenceMax->setText("-");
info_->faceValenceMean->setText("-");
info_->dihedralMin->setText( "-" );
info_->dihedralMean->setText( "-" );
info_->dihedralMax->setText( "-" );
}
//Calculate Bounding Box(min,max,cog)
ACG::Vec3d min;
......
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