mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
Significant changes to use the trivial walker instead of the specialized walker here defined.
This commit is contained in:
parent
ea10dd0d91
commit
c78ae075e9
@ -40,7 +40,7 @@
|
||||
|
||||
#include <vcg/complex/algorithms/create/marching_cubes.h>
|
||||
#include <vcg/complex/algorithms/create/extended_marching_cubes.h>
|
||||
#include "trivial_walker.h"
|
||||
//#include "trivial_walker.h"
|
||||
// local optimization
|
||||
#include <vcg/complex/algorithms/local_optimization.h>
|
||||
#include <vcg/complex/algorithms/local_optimization/tri_edge_collapse.h>
|
||||
@ -455,7 +455,9 @@ void Process(vcg::CallBackPos *cb=0)
|
||||
if(cb) cb(50,"Step 2: Marching Cube...");
|
||||
else printf("Step 2: Marching Cube...\n");
|
||||
/**********************/
|
||||
walker.BuildMesh(me,VV,mc,currentSubBox,currentSubBoxRes);
|
||||
walker.Init(VV,currentSubBox);
|
||||
walker.BuildMesh(me,VV,mc,0);
|
||||
// walker.BuildMesh(me,VV,mc,currentSubBox,currentSubBoxRes);
|
||||
|
||||
typename MCMesh::VertexIterator vi;
|
||||
Box3f bbb; bbb.Import(VV.SubPart);
|
||||
|
||||
@ -383,6 +383,18 @@ public:
|
||||
}
|
||||
/************************************/
|
||||
// Funzioni di accesso ai dati
|
||||
bool ValidCell(const Point3i &p1, const Point3i &p2) const
|
||||
{
|
||||
if(!cV(p1.X(),p1.Y(),p1.Z()).B() ) return false;
|
||||
if(!cV(p2.X(),p1.Y(),p1.Z()).B() ) return false;
|
||||
if(!cV(p1.X(),p2.Y(),p1.Z()).B() ) return false;
|
||||
if(!cV(p2.X(),p2.Y(),p1.Z()).B() ) return false;
|
||||
if(!cV(p1.X(),p1.Y(),p2.Z()).B() ) return false;
|
||||
if(!cV(p2.X(),p1.Y(),p2.Z()).B() ) return false;
|
||||
if(!cV(p1.X(),p2.Y(),p2.Z()).B() ) return false;
|
||||
if(!cV(p2.X(),p2.Y(),p2.Z()).B() ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
float Val(const int &x,const int &y,const int &z) const {
|
||||
if(!cV(x,y,z).B()) return 1000;
|
||||
@ -1217,44 +1229,44 @@ void SlicedPPM( const char * filename,const char *tag,int SliceNum=1)
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
template < class VertexPointerType >
|
||||
void GetXIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v)
|
||||
{
|
||||
float f1 = Val(p1.X(), p1.Y(), p1.Z());
|
||||
float f2 = Val(p2.X(), p2.Y(), p2.Z());
|
||||
float u = (float) f1/(f1-f2);
|
||||
v->P().X() = (float) p1.X()*(1-u) + u*p2.X();
|
||||
v->P().Y() = (float) p1.Y();
|
||||
v->P().Z() = (float) p1.Z();
|
||||
v->Q()=cV(p1.X(), p1.Y(), p1.Z()).Q();
|
||||
v->C()=cV(p1.X(), p1.Y(), p1.Z()).C4b();
|
||||
}
|
||||
template < class VertexPointerType >
|
||||
void GetXIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v, float /*thr*/)
|
||||
{
|
||||
float f1 = Val(p1.X(), p1.Y(), p1.Z());
|
||||
float f2 = Val(p2.X(), p2.Y(), p2.Z());
|
||||
float u = (float) f1/(f1-f2);
|
||||
v->P().X() = (float) p1.X()*(1-u) + u*p2.X();
|
||||
v->P().Y() = (float) p1.Y();
|
||||
v->P().Z() = (float) p1.Z();
|
||||
v->Q()=cV(p1.X(), p1.Y(), p1.Z()).Q();
|
||||
v->C()=cV(p1.X(), p1.Y(), p1.Z()).C4b();
|
||||
}
|
||||
|
||||
template < class VertexPointerType >
|
||||
void GetYIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v)
|
||||
{
|
||||
float f1 = Val(p1.X(), p1.Y(), p1.Z());
|
||||
float f2 = Val(p2.X(), p2.Y(), p2.Z());
|
||||
float u = (float) f1/(f1-f2);
|
||||
v->P().X() = (float) p1.X();
|
||||
v->P().Y() = (float) p1.Y()*(1-u) + u*p2.Y();
|
||||
v->P().Z() = (float) p1.Z();
|
||||
v->Q()=cV(p1.X(), p1.Y(), p1.Z()).Q();
|
||||
v->C()=cV(p1.X(), p1.Y(), p1.Z()).C4b();
|
||||
}
|
||||
template < class VertexPointerType >
|
||||
void GetYIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v, float /*thr*/)
|
||||
{
|
||||
float f1 = Val(p1.X(), p1.Y(), p1.Z());
|
||||
float f2 = Val(p2.X(), p2.Y(), p2.Z());
|
||||
float u = (float) f1/(f1-f2);
|
||||
v->P().X() = (float) p1.X();
|
||||
v->P().Y() = (float) p1.Y()*(1-u) + u*p2.Y();
|
||||
v->P().Z() = (float) p1.Z();
|
||||
v->Q()=cV(p1.X(), p1.Y(), p1.Z()).Q();
|
||||
v->C()=cV(p1.X(), p1.Y(), p1.Z()).C4b();
|
||||
}
|
||||
|
||||
template < class VertexPointerType>
|
||||
void GetZIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v)
|
||||
{
|
||||
float f1 = Val(p1.X(), p1.Y(), p1.Z());
|
||||
float f2 = Val(p2.X(), p2.Y(), p2.Z());
|
||||
float u = (float) f1/(f1-f2);
|
||||
v->P().X() = (float) p1.X();
|
||||
v->P().Y() = (float) p1.Y();
|
||||
v->P().Z() = (float) p1.Z()*(1-u) + u*p2.Z();
|
||||
v->Q()=cV(p1.X(), p1.Y(), p1.Z()).Q();
|
||||
v->C()=cV(p1.X(), p1.Y(), p1.Z()).C4b();
|
||||
}
|
||||
template < class VertexPointerType>
|
||||
void GetZIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v, float /*thr*/)
|
||||
{
|
||||
float f1 = Val(p1.X(), p1.Y(), p1.Z());
|
||||
float f2 = Val(p2.X(), p2.Y(), p2.Z());
|
||||
float u = (float) f1/(f1-f2);
|
||||
v->P().X() = (float) p1.X();
|
||||
v->P().Y() = (float) p1.Y();
|
||||
v->P().Z() = (float) p1.Z()*(1-u) + u*p2.Z();
|
||||
v->Q()=cV(p1.X(), p1.Y(), p1.Z()).Q();
|
||||
v->C()=cV(p1.X(), p1.Y(), p1.Z()).C4b();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user