Speed-up improvments
- Use of the kdTree instead of the staticGrid - Use of OpenMP in the computation of the slice values
This commit is contained in:
parent
2a33dcf967
commit
926020d508
|
@ -27,8 +27,9 @@
|
||||||
#include <vcg/complex/algorithms/update/bounding.h>
|
#include <vcg/complex/algorithms/update/bounding.h>
|
||||||
#include <vcg/complex/algorithms/update/component_ep.h>
|
#include <vcg/complex/algorithms/update/component_ep.h>
|
||||||
#include <vcg/complex/algorithms/create/marching_cubes.h>
|
#include <vcg/complex/algorithms/create/marching_cubes.h>
|
||||||
#include <vcg/space/index/grid_static_ptr.h>
|
//#include <vcg/space/index/grid_static_ptr.h>
|
||||||
#include <vcg/complex/algorithms/closest.h>
|
//#include <vcg/complex/algorithms/closest.h>
|
||||||
|
#include <vcg/space/index/kdtree/kdtree_face.h>
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
|
@ -63,13 +64,15 @@ class Resampler : public BasicGrid<typename NewMeshType::ScalarType>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef int VertexIndex;
|
typedef int VertexIndex;
|
||||||
typedef typename vcg::GridStaticPtr<OldFaceType, OldScalarType> GridType;
|
//typedef typename vcg::GridStaticPtr<OldFaceType, OldScalarType> GridType;
|
||||||
|
typedef vcg::KdTreeFace<OldMeshType> GridType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
int SliceSize;
|
int SliceSize;
|
||||||
int CurrentSlice;
|
int CurrentSlice;
|
||||||
typedef tri::FaceTmark<OldMeshType> MarkerFace;
|
//typedef tri::FaceTmark<OldMeshType> MarkerFace;
|
||||||
|
typedef vcg::tri::EmptyTMark<OldMeshType> MarkerFace;
|
||||||
MarkerFace markerFunctor;
|
MarkerFace markerFunctor;
|
||||||
|
|
||||||
VertexIndex *_x_cs; // indici dell'intersezioni della superficie lungo gli Xedge della fetta corrente
|
VertexIndex *_x_cs; // indici dell'intersezioni della superficie lungo gli Xedge della fetta corrente
|
||||||
|
@ -159,6 +162,7 @@ class Resampler : public BasicGrid<typename NewMeshType::ScalarType>
|
||||||
OldCoordType closestPt;
|
OldCoordType closestPt;
|
||||||
DISTFUNCTOR PDistFunct;
|
DISTFUNCTOR PDistFunct;
|
||||||
OldFaceType *f = _g.GetClosest(PDistFunct,markerFunctor,testPt,max_dist,dist,closestPt);
|
OldFaceType *f = _g.GetClosest(PDistFunct,markerFunctor,testPt,max_dist,dist,closestPt);
|
||||||
|
|
||||||
if (f==NULL) return field_value(false,0);
|
if (f==NULL) return field_value(false,0);
|
||||||
if(AbsDistFlag) return field_value(true,dist);
|
if(AbsDistFlag) return field_value(true,dist);
|
||||||
assert(!f->IsD());
|
assert(!f->IsD());
|
||||||
|
@ -230,6 +234,7 @@ class Resampler : public BasicGrid<typename NewMeshType::ScalarType>
|
||||||
/// the distance of the bb
|
/// the distance of the bb
|
||||||
void ComputeSliceValues(int slice,field_value *slice_values)
|
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 i=0; i<=this->siz.X(); i++)
|
||||||
{
|
{
|
||||||
for (int k=0; k<=this->siz.Z(); k++)
|
for (int k=0; k<=this->siz.Z(); k++)
|
||||||
|
|
Loading…
Reference in New Issue