Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
Plugin-MeshCompare
Compare Revisions
6c565d8e42734149451b1ba97ffd613b16bef284...c0a5e0aa5257e960c230b7f6244e92ab6e70495d
Commits (2)
MeshCompare: Added restriction to selection
· bd3abf1a
Jan Möbius
authored
Nov 14, 2019
bd3abf1a
Rename finder for qwt6
· c0a5e0aa
Jan Möbius
authored
Aug 14, 2020
c0a5e0aa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
13 deletions
+28
-13
CMakeLists.txt
CMakeLists.txt
+2
-2
MeshComparePlugin.cc
MeshComparePlugin.cc
+13
-8
MeshComparePlugin.hh
MeshComparePlugin.hh
+4
-2
MeshCompareToolbar.ui
MeshCompareToolbar.ui
+7
-0
PythonInterface/Python.cc
PythonInterface/Python.cc
+2
-1
No files found.
CMakeLists.txt
View file @
c0a5e0aa
include
(
plugin
)
find_package
(
Q
wt
6
)
find_package
(
Q
WT
6
)
if
(
QWT6_FOUND
)
add_definitions
(
-DWITH_QWT
)
openflipper_plugin
(
PYTHONINTERFACE
DEPS Q
wt
6
DEPS Q
WT
6
INSTALLDATA Icons
TYPES POLYMESH TRIANGLEMESH
)
...
...
MeshComparePlugin.cc
View file @
c0a5e0aa
...
...
@@ -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
);
...
...
MeshComparePlugin.hh
View file @
c0a5e0aa
...
...
@@ -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_
;
};
...
...
MeshCompareToolbar.ui
View file @
c0a5e0aa
...
...
@@ -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>
...
...
PythonInterface/Python.cc
View file @
c0a5e0aa
...
...
@@ -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
()
);
...
...