From 926020d508984c24adc07004f6038a4afb7a515a Mon Sep 17 00:00:00 2001 From: gianpaolopalma Date: Thu, 22 Feb 2018 11:32:17 +0100 Subject: [PATCH] Speed-up improvments - Use of the kdTree instead of the staticGrid - Use of OpenMP in the computation of the slice values --- vcg/complex/algorithms/create/resampler.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/create/resampler.h b/vcg/complex/algorithms/create/resampler.h index 9d6b6f3a..edf9eae5 100644 --- a/vcg/complex/algorithms/create/resampler.h +++ b/vcg/complex/algorithms/create/resampler.h @@ -27,8 +27,9 @@ #include #include #include -#include -#include +//#include +//#include +#include namespace vcg { namespace tri { @@ -63,13 +64,15 @@ class Resampler : public BasicGrid { private: typedef int VertexIndex; - typedef typename vcg::GridStaticPtr GridType; + //typedef typename vcg::GridStaticPtr GridType; + typedef vcg::KdTreeFace GridType; protected: int SliceSize; int CurrentSlice; - typedef tri::FaceTmark MarkerFace; + //typedef tri::FaceTmark MarkerFace; + typedef vcg::tri::EmptyTMark MarkerFace; MarkerFace markerFunctor; VertexIndex *_x_cs; // indici dell'intersezioni della superficie lungo gli Xedge della fetta corrente @@ -159,6 +162,7 @@ class Resampler : public BasicGrid OldCoordType closestPt; DISTFUNCTOR PDistFunct; OldFaceType *f = _g.GetClosest(PDistFunct,markerFunctor,testPt,max_dist,dist,closestPt); + if (f==NULL) return field_value(false,0); if(AbsDistFlag) return field_value(true,dist); assert(!f->IsD()); @@ -230,6 +234,7 @@ class Resampler : public BasicGrid /// the distance of the bb void ComputeSliceValues(int slice,field_value *slice_values) { +#pragma omp parallel for schedule(dynamic, 10) for (int i=0; i<=this->siz.X(); i++) { for (int k=0; k<=this->siz.Z(); k++)