+ method to get Eigensystem of mesh data

This commit is contained in:
wmayer 2015-03-10 22:47:46 +01:00
parent cc7c1d1f44
commit 9ba57683d5
4 changed files with 28 additions and 0 deletions

View File

@ -790,6 +790,15 @@ void MeshObject::transformToEigenSystem()
this->setTransform(cMeshEval.Transform());
}
Base::Matrix4D MeshObject::getEigenSystem(Base::Vector3d& v) const
{
MeshCore::MeshEigensystem cMeshEval(_kernel);
cMeshEval.Evaluate();
Base::Vector3f uvw = cMeshEval.GetBoundings();
v.Set(uvw.x, uvw.y, uvw.z);
return cMeshEval.Transform();
}
void MeshObject::movePoint(unsigned long index, const Base::Vector3d& v)
{
// v is a vector, hence we must not apply the translation part

View File

@ -200,6 +200,7 @@ public:
/// clears the Mesh
void clear(void);
void transformToEigenSystem();
Base::Matrix4D getEigenSystem(Base::Vector3d& v) const;
void movePoint(unsigned long, const Base::Vector3d& v);
void setPoint(unsigned long, const Base::Vector3d& v);
void smooth(int iterations, float d_max);

View File

@ -112,6 +112,11 @@ Example:
<UserDocu>Transform the mesh to its eigenbase</UserDocu>
</Documentation>
</Methode>
<Methode Name="getEigenSystem" Const="true">
<Documentation>
<UserDocu>Get Eigen base of the mesh</UserDocu>
</Documentation>
</Methode>
<Methode Name="addFacet">
<Documentation>
<UserDocu>Add a facet to the mesh</UserDocu>

View File

@ -27,6 +27,7 @@
#include <Base/Handle.h>
#include <Base/Builder3D.h>
#include <Base/GeometryPyCXX.h>
#include <Base/MatrixPy.h>
#include "Mesh.h"
#include "MeshPy.h"
@ -465,6 +466,18 @@ PyObject* MeshPy::transformToEigen(PyObject *args)
Py_Return;
}
PyObject* MeshPy::getEigenSystem(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Base::Vector3d vec;
Base::Matrix4D mat = getMeshObjectPtr()->getEigenSystem(vec);
Py::Tuple t(2);
t.setItem(0, Py::Matrix(mat));
t.setItem(1, Py::Vector(vec));
return Py::new_reference_to(t);
}
PyObject* MeshPy::addFacet(PyObject *args)
{
double x1,y1,z1,x2,y2,z2,x3,y3,z3;