corrected test with max distance in ray Iterator

This commit is contained in:
Nico Pietroni 2007-03-26 08:12:30 +00:00
parent 63e2cdd95f
commit c466753fe5
1 changed files with 13 additions and 3 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.25 2007/03/08 17:05:50 pietroni
line 375, corrected 1 error concerning intersection with bounding of the grid
Revision 1.24 2007/02/20 16:22:50 ganovelli Revision 1.24 2007/02/20 16:22:50 ganovelli
modif in ClosestIterator to include the last shell Si.siz [X|Y|X]. Tested with minialign and point based animation modif in ClosestIterator to include the last shell Si.siz [X|Y|X]. Tested with minialign and point based animation
@ -140,7 +143,14 @@ namespace vcg{
void _NextCell() void _NextCell()
{ {
assert(!end); assert(!end);
ScalarType testmax_dist=(r.Origin()-goal).Norm(); vcg::Box3<ScalarType> bb_current;
Si.IPToP(CurrentCell,bb_current.min);
Si.IPToP(CurrentCell+vcg::Point3i(1,1,1),bb_current.max);
CoordType inters;
Intersection_Ray_Box(bb_current,r,inters);
ScalarType testmax_dist=(inters-r.Origin()).Norm();
if (testmax_dist>max_dist) if (testmax_dist>max_dist)
end=true; end=true;
@ -233,7 +243,7 @@ namespace vcg{
ObjType* elem=&(*(*l)); ObjType* elem=&(*(*l));
ScalarType t; ScalarType t;
CoordType Int; CoordType Int;
if((!elem->IsD())&&(!tm.IsMarked(elem))&&(int_funct((**l),r,t))) if((!elem->IsD())&&(!tm.IsMarked(elem))&&(int_funct((**l),r,t))&&(t<=max_dist))
{ {
Int=r.Origin()+r.Direction()*t; Int=r.Origin()+r.Direction()*t;
Elems.push_back(Entry_Type(elem,t,Int)); Elems.push_back(Entry_Type(elem,t,Int));
@ -400,7 +410,7 @@ namespace vcg{
tm=_tm; tm=_tm;
} }
///initialize the Itarator ///initialize the Iterator
void Init(CoordType _p,const ScalarType &_max_dist) void Init(CoordType _p,const ScalarType &_max_dist)
{ {
explored.SetNull(); explored.SetNull();