- Change to avoid dangerous iterators decrement in RayITerator: reverse iterator used (same as in ClosestIterator)
-removed some old commented code
This commit is contained in:
parent
1a9220ce98
commit
3712ddfd50
|
|
@ -56,7 +56,6 @@ added missing header
|
||||||
#include <vcg/space/intersection3.h>
|
#include <vcg/space/intersection3.h>
|
||||||
#include <vcg/space/point3.h>
|
#include <vcg/space/point3.h>
|
||||||
#include <vcg/space/box3.h>
|
#include <vcg/space/box3.h>
|
||||||
//#include <vcg/space/point4.h>
|
|
||||||
#include <vcg/space/ray3.h>
|
#include <vcg/space/ray3.h>
|
||||||
#include <vcg/math/base.h>
|
#include <vcg/math/base.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
@ -251,28 +250,18 @@ namespace vcg{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
////then control if there are more than 1 element
|
////then control if there are more than 1 element
|
||||||
if (Elems.size()>1)
|
std::sort(Elems.begin(),Elems.end());
|
||||||
std::sort(Elems.begin(),Elems.end());
|
CurrentElem=Elems.rbegin();
|
||||||
|
|
||||||
CurrentElem=Elems.end();
|
|
||||||
if (Elems.size() > 0) {
|
|
||||||
CurrentElem--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return((Elems.size()==0)||(Dist()>dist));
|
return((Elems.size()==0)||(Dist()>dist));
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator ++()
|
void operator ++()
|
||||||
{
|
{
|
||||||
//if (CurrentElem!=Elems.end())
|
if (!Elems.empty()) Elems.pop_back();
|
||||||
if (Elems.size()>0)
|
|
||||||
{
|
CurrentElem = Elems.rbegin();
|
||||||
CurrentElem--;
|
|
||||||
//std::pop_heap<ElemIterator>(Elems.begin(),Elems.end());
|
|
||||||
Elems.pop_back();
|
|
||||||
}
|
|
||||||
/*if (CurrentElem==Elems.end())
|
|
||||||
{*/
|
|
||||||
if (Dist()>dist)
|
if (Dist()>dist)
|
||||||
{
|
{
|
||||||
if (!End())
|
if (!End())
|
||||||
|
|
@ -296,7 +285,6 @@ namespace vcg{
|
||||||
else
|
else
|
||||||
return ((ScalarType)FLT_MAX);
|
return ((ScalarType)FLT_MAX);
|
||||||
}
|
}
|
||||||
//{return ((*CurrentElem).dist);}
|
|
||||||
|
|
||||||
///set the current spatial indexing structure used
|
///set the current spatial indexing structure used
|
||||||
void SetIndexStructure(Spatial_Idexing &_Si)
|
void SetIndexStructure(Spatial_Idexing &_Si)
|
||||||
|
|
@ -323,14 +311,14 @@ namespace vcg{
|
||||||
CoordType intersection;
|
CoordType intersection;
|
||||||
};
|
};
|
||||||
|
|
||||||
RayType r; //ray to find intersections
|
RayType r; //ray to find intersections
|
||||||
Spatial_Idexing &Si; //reference to spatial index algorithm
|
Spatial_Idexing &Si; //reference to spatial index algorithm
|
||||||
bool end; //true if the scan is terminated
|
bool end; //true if the scan is terminated
|
||||||
INTFUNCTOR &int_funct;
|
INTFUNCTOR &int_funct;
|
||||||
TMARKER tm;
|
TMARKER tm;
|
||||||
|
|
||||||
std::vector<Entry_Type> Elems; //element loaded from curren cell
|
std::vector<Entry_Type> Elems; //element loaded from curren cell
|
||||||
typedef typename std::vector<Entry_Type>::iterator ElemIterator;
|
typedef typename std::vector<Entry_Type>::reverse_iterator ElemIterator;
|
||||||
ElemIterator CurrentElem; //iterator to current element
|
ElemIterator CurrentElem; //iterator to current element
|
||||||
|
|
||||||
vcg::Point3i CurrentCell; //current cell
|
vcg::Point3i CurrentCell; //current cell
|
||||||
|
|
@ -429,19 +417,6 @@ namespace vcg{
|
||||||
|
|
||||||
while ((!End())&& Refresh()&&(!_EndGrid()))
|
while ((!End())&& Refresh()&&(!_EndGrid()))
|
||||||
_NextShell();
|
_NextShell();
|
||||||
|
|
||||||
/////until don't find an element
|
|
||||||
/////that is inside the radius
|
|
||||||
//while ((!End())&&(Dist()>radius))
|
|
||||||
//{
|
|
||||||
// if ((_NextShell())&&(!_EndGrid()))
|
|
||||||
// Refresh();
|
|
||||||
//}
|
|
||||||
|
|
||||||
////set to the last element ..the nearest
|
|
||||||
//CurrentElem=Elems.end();
|
|
||||||
//CurrentElem--;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//return true if the scan is complete
|
//return true if the scan is complete
|
||||||
|
|
@ -543,12 +518,12 @@ namespace vcg{
|
||||||
CoordType intersection;
|
CoordType intersection;
|
||||||
};
|
};
|
||||||
|
|
||||||
CoordType p; //initial point
|
CoordType p; //initial point
|
||||||
Spatial_Idexing &Si; //reference to spatial index algorithm
|
Spatial_Idexing &Si; //reference to spatial index algorithm
|
||||||
bool end; //true if the scan is terminated
|
bool end; //true if the scan is terminated
|
||||||
ScalarType max_dist; //max distance when the scan terminate
|
ScalarType max_dist; //max distance when the scan terminate
|
||||||
vcg::Box3i explored; //current bounding box explored
|
vcg::Box3i explored; //current bounding box explored
|
||||||
vcg::Box3i to_explore; //current bounding box explored
|
vcg::Box3i to_explore; //current bounding box explored
|
||||||
ScalarType radius; //curret radius for sphere expansion
|
ScalarType radius; //curret radius for sphere expansion
|
||||||
ScalarType step_size; //radius step
|
ScalarType step_size; //radius step
|
||||||
std::vector<Entry_Type> Elems; //element loaded from the current sphere
|
std::vector<Entry_Type> Elems; //element loaded from the current sphere
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue