Cleaning up sample prog
This commit is contained in:
parent
ef724af624
commit
121d356fbf
|
@ -1,6 +1,8 @@
|
|||
DEPENDPATH += . ../../..
|
||||
INCLUDEPATH += . ../../..
|
||||
CONFIG += console stl
|
||||
CONFIG += console c++11
|
||||
TEMPLATE = app
|
||||
# Mac specific Config required to avoid to make application bundles
|
||||
CONFIG -= app_bundle
|
||||
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
|
|
|
@ -98,7 +98,7 @@ void example2(){
|
|||
|
||||
// normally, faces with more than 4sides are split into parallelograms
|
||||
// this merges them (optional, try removing it!)
|
||||
vcg::tri::PolygonSupport<MyMesh,int>::MergeFlatFaces(m);
|
||||
vcg::tri::PolygonSupport<MyMesh,MyMesh>::MergeFlatFaces(m);
|
||||
|
||||
int savemask = vcg::tri::io::Mask::IOM_BITPOLYGONAL;
|
||||
vcg::tri::io::ExporterOFF<MyMesh>::Save(m,fullMeshFilename,savemask);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include <iostream>
|
||||
#include <QTime>
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#include "nanoflann.hpp"
|
||||
|
||||
|
@ -77,21 +79,25 @@ void testKDTree(CMesh& mesh, std::vector<unsigned int>& test_indeces, std::vecto
|
|||
vcg::ConstDataWrapper<CMesh::VertexType::CoordType> wrapperVcg(&mesh.vert[0].P(), mesh.vert.size(), size_t(mesh.vert[1].P().V()) - size_t(mesh.vert[0].P().V()));
|
||||
vcg::KdTree<CMesh::ScalarType> kdTreeVcg(wrapperVcg);
|
||||
std::cout << "Build: " << time.elapsed() << " ms" << std::endl;
|
||||
|
||||
int nn=1;
|
||||
// Computation of the point radius
|
||||
float mAveragePointSpacing = 0;
|
||||
time.restart();
|
||||
#pragma omp parallel for reduction(+: mAveragePointSpacing) schedule(dynamic, 10)
|
||||
for (int i = 0; i < mesh.vert.size(); i++)
|
||||
{
|
||||
#ifdef #ifdef _OPENMP
|
||||
nn =omp_get_num_threads();
|
||||
#endif
|
||||
vcg::KdTree<CMesh::ScalarType>::PriorityQueue queue;
|
||||
kdTreeVcg.doQueryK(mesh.vert[i].cP(), 16, queue);
|
||||
float newRadius = 2.0f * sqrt(queue.getWeight(0)/ queue.getNofElements());
|
||||
mesh.vert[i].R() -= newRadius;
|
||||
mAveragePointSpacing += newRadius;
|
||||
}
|
||||
std::cout << "Num trhread " << nn << std::endl;
|
||||
mAveragePointSpacing /= mesh.vert.size();
|
||||
std::cout << "Average point radius (OpenMP) " << mAveragePointSpacing << std::endl;
|
||||
std::cout << "Average point radius (OpenMP with" << nn << " threads) " << mAveragePointSpacing << std::endl;
|
||||
std::cout << "Time (OpenMP): " << time.elapsed() << " ms" << std::endl;
|
||||
|
||||
queryDist = mAveragePointSpacing * 150;
|
||||
|
@ -403,9 +409,10 @@ void testOctree(CMesh& mesh, std::vector<unsigned int>& test_indeces, std::vecto
|
|||
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
if (argc < 2)
|
||||
if (argc < 2) {
|
||||
std::cout << "Invalid arguments" << std::endl;
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
CMesh mesh;
|
||||
if (vcg::tri::io::Importer<CMesh>::Open(mesh, argv[1]) != 0)
|
||||
std::cout << "Invalid filename" << std::endl;
|
||||
|
|
Loading…
Reference in New Issue