Commits (2)
include(plugin)
find_package(Qwt6)
find_package(QWT6)
if (QWT6_FOUND)
add_definitions(-DWITH_QWT)
openflipper_plugin(PYTHONINTERFACE
DEPS Qwt6
DEPS QWT6
INSTALLDATA Icons
TYPES POLYMESH TRIANGLEMESH
)
......
......@@ -173,7 +173,8 @@ void MeshComparePlugin::compareButton() {
compare(sourceObject->id(),targetObject->id(), tool_->distance->isChecked() ,
tool_->normalAngle->isChecked(),
tool_->gaussCurvature->isChecked(),
tool_->meanCurvature->isChecked() );
tool_->meanCurvature->isChecked(),
tool_->selection->isChecked());
} else {
emit log(LOGERR,tr("Please select one source and one target mesh to compare! Source will be the reference mesh."));
}
......@@ -216,7 +217,7 @@ void MeshComparePlugin::slotClampBox(bool _checked) {
}
}
void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, bool _computeNormal, bool _computeGauss , bool _computeMean) {
void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, bool _computeNormal, bool _computeGauss , bool _computeMean, bool _selection) {
TriMeshObject* source = PluginFunctions::triMeshObject(_sourceId);
......@@ -319,9 +320,13 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
std::vector<double> meanCurvatures;
std::vector<double> gaussCurvatures;
for ( TriMesh::VertexIter v_it = refMesh->vertices_begin() ; v_it != refMesh->vertices_end(); ++ v_it) {
TriMeshObject::OMTriangleBSP::NearestNeighbor nearest = compBSP->nearest(refMesh->point(*v_it));
for (auto v_it : refMesh->vertices()) {
if ( _selection && refMesh->status(v_it).selected() == false) {
continue;
}
TriMeshObject::OMTriangleBSP::NearestNeighbor nearest = compBSP->nearest(refMesh->point(v_it));
TriMesh::FaceHandle closestFace = nearest.handle;
// Remember the maximal distance between the meshes
......@@ -348,7 +353,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
// project original point to current mesh
TriMesh::Point projectedPoint;
ACG::Geometry::distPointTriangle(refMesh->point(*v_it), p0, p1, p2, projectedPoint);
ACG::Geometry::distPointTriangle(refMesh->point(v_it), p0, p1, p2, projectedPoint);
// Add the position to the point node
if (pNode)
......@@ -366,7 +371,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
normal.normalize();
// Compute normal deviation in degrees
double normalDeviation = (refMesh->normal(*v_it) | normal);
double normalDeviation = (refMesh->normal(v_it) | normal);
if (normalDeviation < -1.0)
normalDeviation = -1.0;
......@@ -388,7 +393,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
compMesh->property(meanComp, v1) * projectedPoint[1] +
compMesh->property(meanComp, v2) * projectedPoint[2];
const double curvatureDev = fabs(refMesh->property(meanRef, *v_it) - curvature);
const double curvatureDev = fabs(refMesh->property(meanRef, v_it) - curvature);
meanCurvatures.push_back(curvatureDev);
......@@ -402,7 +407,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
compMesh->property(gaussComp, v1) * projectedPoint[1] +
compMesh->property(gaussComp, v2) * projectedPoint[2];
const double curvatureDev = fabs(refMesh->property(gaussRef, *v_it) - curvature);
const double curvatureDev = fabs(refMesh->property(gaussRef, v_it) - curvature);
gaussCurvatures.push_back(curvatureDev);
......
......@@ -139,12 +139,14 @@ class MeshComparePlugin : public QObject, BaseInterface, ToolboxInterface, Loggi
* @param _computeNormal Compute normal deviation between meshes
* @param _computeGauss Compute gauss curvature deviation between meshes
* @param _computeMean Compute mean curvature deviation between meshes
* @param _selection Compare only selected vertices
*/
void compare(int _sourceId,int _targetId,
bool _computeDist = true,
bool _computeNormal = true,
bool _computeGauss = true ,
bool _computeMean = true);
bool _computeGauss = true,
bool _computeMean = true,
bool _selection_ = false);
/// Get the maximal distance of the last comparison (-1, if no comparison performed so far)
double lastMaximalDistance() { return maximalDistance_; };
......
......@@ -79,6 +79,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="selection">
<property name="text">
<string>Compare only selected vertices</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -87,7 +87,8 @@ PYBIND11_EMBEDDED_MODULE(MeshCompare, m) {
py::arg(QCoreApplication::translate("PythonDocMeshCompare","Compute distance between meshes").toLatin1().data()) = true,
py::arg(QCoreApplication::translate("PythonDocMeshCompare","Compute normal deviation between meshes").toLatin1().data()) = true,
py::arg(QCoreApplication::translate("PythonDocMeshCompare","Compute Gauss curvature deviation between meshes").toLatin1().data()) = true,
py::arg(QCoreApplication::translate("PythonDocMeshCompare","Compute mean curvature deviation between meshes").toLatin1().data()) = true );
py::arg(QCoreApplication::translate("PythonDocMeshCompare","Compute mean curvature deviation between meshes").toLatin1().data()) = true,
py::arg(QCoreApplication::translate("PythonDocMeshCompare","Compare only selected vertices").toLatin1().data()) = false);
compare.def("lastMaximalDistance", &MeshComparePlugin::lastMaximalDistance,
QCoreApplication::translate("PythonDocMeshCompare","Get the maximal distance of the last comparison (-1, if no comparison performed so far)").toLatin1().data() );
......