+ allow to set parameters for surface triangulation from outside

This commit is contained in:
wmayer 2015-10-21 23:18:53 +02:00
parent e7a3dc48e8
commit 62da38339f
3 changed files with 8 additions and 6 deletions

View File

@ -84,7 +84,9 @@ static PyObject *
triangulate(PyObject *self, PyObject *args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O!", &(Points::PointsPy::Type), &pcObj))
double searchRadius;
double mu=2.5;
if (!PyArg_ParseTuple(args, "O!d|d", &(Points::PointsPy::Type), &pcObj, &searchRadius, &mu))
return NULL;
Points::PointsPy* pPoints = static_cast<Points::PointsPy*>(pcObj);
@ -92,7 +94,7 @@ triangulate(PyObject *self, PyObject *args)
Mesh::MeshObject* mesh = new Mesh::MeshObject();
SurfaceTriangulation tria(*points, *mesh);
tria.perform();
tria.perform(searchRadius, mu);
return new Mesh::MeshPy(mesh);
}

View File

@ -59,7 +59,7 @@ SurfaceTriangulation::SurfaceTriangulation(const Points::PointKernel& pts, Mesh:
{
}
void SurfaceTriangulation::perform()
void SurfaceTriangulation::perform(double searchRadius, double mu)
{
PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>);
PointCloud<PointNormal>::Ptr cloud_with_normals (new PointCloud<PointNormal>);
@ -96,8 +96,8 @@ void SurfaceTriangulation::perform()
// Set parameters
gp3.setInputCloud (cloud_with_normals);
gp3.setSearchMethod (tree2);
gp3.setSearchRadius (2.025);
gp3.setMu (2.5);
gp3.setSearchRadius (searchRadius);
gp3.setMu (mu);
gp3.setMaximumNearestNeighbors (100);
gp3.setMaximumSurfaceAngle(M_PI/4); // 45 degrees
gp3.setMinimumAngle(M_PI/18); // 10 degrees

View File

@ -33,7 +33,7 @@ class SurfaceTriangulation
{
public:
SurfaceTriangulation(const Points::PointKernel&, Mesh::MeshObject&);
void perform();
void perform(double searchRadius, double mu);
private:
const Points::PointKernel& myPoints;