typenmaes added, using namespace std deleted
This commit is contained in:
parent
7761b396ab
commit
f81c3c76de
|
@ -1,4 +1,4 @@
|
||||||
#include<vector>
|
#include<std::vector>
|
||||||
#include<vcg/space/point3.h>
|
#include<vcg/space/point3.h>
|
||||||
#include<vcg/space/plane3.h>
|
#include<vcg/space/plane3.h>
|
||||||
#include<vcg/space/segment3.h>
|
#include<vcg/space/segment3.h>
|
||||||
|
@ -6,7 +6,6 @@
|
||||||
#include<vcg/space/index/grid_static_ptr.h>
|
#include<vcg/space/index/grid_static_ptr.h>
|
||||||
|
|
||||||
#include<vcg/complex/trimesh/base.h>
|
#include<vcg/complex/trimesh/base.h>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace vcg{
|
namespace vcg{
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ namespace vcg{
|
||||||
Function computing the intersection between a grid and a plane. It returns all the cells intersected
|
Function computing the intersection between a grid and a plane. It returns all the cells intersected
|
||||||
*/
|
*/
|
||||||
template < typename GridType,typename ScalarType>
|
template < typename GridType,typename ScalarType>
|
||||||
bool Intersect( GridType & grid,Plane3<ScalarType> plane, vector<typename GridType::Cell *> &cells){
|
bool Intersect( GridType & grid,Plane3<ScalarType> plane, std::vector<typename GridType::Cell *> &cells){
|
||||||
Point3d p,_d;
|
Point3d p,_d;
|
||||||
Plane3d pl;
|
Plane3d pl;
|
||||||
_d.Import(plane.Direction());
|
_d.Import(plane.Direction());
|
||||||
|
@ -43,7 +42,7 @@ bool Intersect( GridType & grid,Plane3<ScalarType> plane, vector<typename Grid
|
||||||
seg.P1()[axis1] = grid.bbox.min[axis1]+ (j+0.01) * grid.voxel[axis1];
|
seg.P1()[axis1] = grid.bbox.min[axis1]+ (j+0.01) * grid.voxel[axis1];
|
||||||
if ( Intersection(pl,seg,p))
|
if ( Intersection(pl,seg,p))
|
||||||
{
|
{
|
||||||
pi[axis] = min(max(0,floor((p[axis ]-grid.bbox.min[axis])/grid.voxel[axis])),grid.siz[axis]);
|
pi[axis] = min(max(0,(int)floor((p[axis ]-grid.bbox.min[axis])/grid.voxel[axis])),grid.siz[axis]);
|
||||||
pi[axis0] = i;
|
pi[axis0] = i;
|
||||||
pi[axis1] = j;
|
pi[axis1] = j;
|
||||||
grid.Grid(pi,axis,cells);
|
grid.Grid(pi,axis,cells);
|
||||||
|
@ -75,25 +74,25 @@ bool Intersection( /*TriMeshType & m, */
|
||||||
EdgeMeshType & em,
|
EdgeMeshType & em,
|
||||||
double& ave_length,
|
double& ave_length,
|
||||||
typename GridStaticPtr<typename TriMeshType::FaceContainer> *grid,
|
typename GridStaticPtr<typename TriMeshType::FaceContainer> *grid,
|
||||||
typename vector< typename GridStaticPtr<typename TriMeshType::FaceContainer>::Cell* >& cells)
|
typename std::vector< typename GridStaticPtr<typename TriMeshType::FaceContainer>::Cell* >& cells)
|
||||||
{
|
{
|
||||||
typedef typename TriMeshType::FaceContainer FaceContainer;
|
typedef typename TriMeshType::FaceContainer FaceContainer;
|
||||||
typedef GridStaticPtr<FaceContainer> GridType;
|
typedef GridStaticPtr<FaceContainer> GridType;
|
||||||
EdgeMeshType::VertexIterator vi;
|
typename EdgeMeshType::VertexIterator vi;
|
||||||
TriMeshType::FaceIterator fi;
|
typename TriMeshType::FaceIterator fi;
|
||||||
vector<TriMeshType::FaceType*> v;
|
std::vector<typename TriMeshType::FaceType*> v;
|
||||||
v.clear();
|
v.clear();
|
||||||
Intersect(*grid,pl,cells);
|
Intersect(*grid,pl,cells);
|
||||||
Segment3<ScalarType> seg;
|
Segment3<ScalarType> seg;
|
||||||
ave_length = 0.0;
|
ave_length = 0.0;
|
||||||
vector<GridType::Cell*>::iterator ic;
|
typename std::vector<typename GridType::Cell*>::iterator ic;
|
||||||
GridType::Cell fs,ls;
|
typename GridType::Cell fs,ls;
|
||||||
for(ic = cells.begin(); ic != cells.end();++ic)
|
for(ic = cells.begin(); ic != cells.end();++ic)
|
||||||
{
|
{
|
||||||
grid->Grid(*ic,fs,ls);
|
grid->Grid(*ic,fs,ls);
|
||||||
GridType::Link * lk = fs;
|
typename GridType::Link * lk = fs;
|
||||||
while(lk != ls){
|
while(lk != ls){
|
||||||
TriMeshType::FaceType & face = *(lk->Elem());
|
typename TriMeshType::FaceType & face = *(lk->Elem());
|
||||||
if(!face.IsS())
|
if(!face.IsS())
|
||||||
{
|
{
|
||||||
face.SetS();
|
face.SetS();
|
||||||
|
@ -116,7 +115,7 @@ bool Intersection( /*TriMeshType & m, */
|
||||||
}//end while
|
}//end while
|
||||||
}
|
}
|
||||||
ave_length/=em.en;
|
ave_length/=em.en;
|
||||||
vector<TriMeshType::FaceType*>::iterator v_i;
|
typename std::vector<typename TriMeshType::FaceType*>::iterator v_i;
|
||||||
for(v_i=v.begin(); v_i!=v.end(); ++v_i) (*v_i)->ClearS();
|
for(v_i=v.begin(); v_i!=v.end(); ++v_i) (*v_i)->ClearS();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -133,13 +132,13 @@ bool IntersectionRayMesh(
|
||||||
/* Intersect Point */ Point3<ScalarType> & hitPoint)
|
/* Intersect Point */ Point3<ScalarType> & hitPoint)
|
||||||
{
|
{
|
||||||
//typedef typename TriMeshType::FaceContainer FaceContainer;
|
//typedef typename TriMeshType::FaceContainer FaceContainer;
|
||||||
TriMeshType::FaceIterator fi;
|
typename TriMeshType::FaceIterator fi;
|
||||||
bool hit=false;
|
bool hit=false;
|
||||||
|
|
||||||
if(m==0) return false;
|
if(m==0) return false;
|
||||||
|
|
||||||
//TriMeshType::FaceIterator fi;
|
//TriMeshType::FaceIterator fi;
|
||||||
//vector<TriMeshType::FaceType*>::iterator fi;
|
//std::vector<TriMeshType::FaceType*>::iterator fi;
|
||||||
|
|
||||||
ScalarType bar1,bar2,dist;
|
ScalarType bar1,bar2,dist;
|
||||||
Point3<ScalarType> p1;
|
Point3<ScalarType> p1;
|
||||||
|
|
Loading…
Reference in New Issue