Mesh: [skip ci] expose some mesh evaluation functions to Python

This commit is contained in:
wmayer
2021-02-14 12:02:45 +01:00
parent dac937ae35
commit d941c114cb
4 changed files with 82 additions and 2 deletions

View File

@@ -1497,6 +1497,30 @@ void MeshObject::validateIndices()
this->_segments.clear();
}
bool MeshObject::hasInvalidNeighbourhood() const
{
MeshCore::MeshEvalNeighbourhood eval(_kernel);
return !eval.Evaluate();
}
bool MeshObject::hasPointsOutOfRange() const
{
MeshCore::MeshEvalRangePoint eval(_kernel);
return !eval.Evaluate();
}
bool MeshObject::hasFacetsOutOfRange() const
{
MeshCore::MeshEvalRangeFacet eval(_kernel);
return !eval.Evaluate();
}
bool MeshObject::hasCorruptedFacets() const
{
MeshCore::MeshEvalCorruptedFacets eval(_kernel);
return !eval.Evaluate();
}
void MeshObject::validateDeformations(float fMaxAngle, float fEps)
{
unsigned long count = _kernel.CountFacets();

View File

@@ -283,6 +283,10 @@ public:
void removeDuplicatedPoints();
void removeDuplicatedFacets();
bool hasNonManifolds() const;
bool hasInvalidNeighbourhood() const;
bool hasPointsOutOfRange() const;
bool hasFacetsOutOfRange() const;
bool hasCorruptedFacets() const;
void removeNonManifolds();
void removeNonManifoldPoints();
bool hasSelfIntersections() const;

View File

@@ -229,7 +229,7 @@ for c in mesh.getSeparatecomponents():
<UserDocu>Check if the mesh has non-manifolds</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeNonManifolds">
<Methode Name="removeNonManifolds">
<Documentation>
<UserDocu>Remove non-manifolds</UserDocu>
</Documentation>
@@ -284,7 +284,27 @@ for c in mesh.getSeparatecomponents():
<UserDocu>Remove points with invalid coordinates (NaN)</UserDocu>
</Documentation>
</Methode>
<Methode Name="countComponents" Const="true">
<Methode Name="hasInvalidNeighbourhood" Const="true">
<Documentation>
<UserDocu>Check if the mesh has invalid neighbourhood indices</UserDocu>
</Documentation>
</Methode>
<Methode Name="hasPointsOutOfRange" Const="true">
<Documentation>
<UserDocu>Check if the mesh has point indices that are out of range</UserDocu>
</Documentation>
</Methode>
<Methode Name="hasFacetsOutOfRange" Const="true">
<Documentation>
<UserDocu>Check if the mesh has facet indices that are out of range</UserDocu>
</Documentation>
</Methode>
<Methode Name="hasCorruptedFacets" Const="true">
<Documentation>
<UserDocu>Check if the mesh has corrupted facets</UserDocu>
</Documentation>
</Methode>
<Methode Name="countComponents" Const="true">
<Documentation>
<UserDocu>Get the number of topologic independent areas</UserDocu>
</Documentation>

View File

@@ -972,6 +972,38 @@ PyObject* MeshPy::hasNonManifolds(PyObject *args)
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
PyObject* MeshPy::hasInvalidNeighbourhood(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
bool ok = getMeshObjectPtr()->hasInvalidNeighbourhood();
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
PyObject* MeshPy::hasPointsOutOfRange(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
bool ok = getMeshObjectPtr()->hasPointsOutOfRange();
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
PyObject* MeshPy::hasFacetsOutOfRange(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
bool ok = getMeshObjectPtr()->hasFacetsOutOfRange();
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
PyObject* MeshPy::hasCorruptedFacets(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
bool ok = getMeshObjectPtr()->hasFacetsOutOfRange();
return Py_BuildValue("O", (ok ? Py_True : Py_False));
}
PyObject* MeshPy::removeNonManifolds(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))