Small change to make the bbox function in segment equal to the other vcg object (getbbox instead of bbox)

This commit is contained in:
Paolo Cignoni 2016-06-12 21:10:46 +00:00
parent 682586d0fa
commit 47334c555d
4 changed files with 20 additions and 24 deletions

View File

@ -169,11 +169,13 @@ MySegmentType * DoRay(MyRayType & _r,
void GetInBoxSegmentsBruteF( vcg::Box2<MyScalarType> bbox,
std::vector<MySegmentType*> &result)
{
for (size_t i=0;i<AllocatedSeg.size();i++)
{
if (!AllocatedSeg[i].BBox().Collide(bbox))continue;
result.push_back(&AllocatedSeg[i]);
}
vcg::Box2<MyScalarType> ibbox;
for (size_t i=0;i<AllocatedSeg.size();i++)
{
AllocatedSeg[i].GetBBox(ibbox);
if (!ibbox.Collide(bbox)) continue;
result.push_back(&AllocatedSeg[i]);
}
}
MySegmentType* GetClosesestSegmentBruteF(MyCoordType & _p,

View File

@ -1,15 +1,7 @@
######################################################################
# Automatically generated by qmake (2.00a) ven 24. giu 14:14:20 2005
######################################################################
TARGET = test_hash2d
DEPENDPATH += .
INCLUDEPATH += . ../../..
CONFIG += console stl
TEMPLATE = app
include(../common.pri)
TARGET = space_index_2d
HEADERS += ../../../vcg/space/index/grid_static_ptr2d.h\
../../../vcg/space/index/closest2d.h\
../../../vcg/space/index/space_iterators2d.h\
../../../vcg/space/index/grid_closest2d.h
SOURCES += test_hash2d.cpp
SOURCES += space_index_2d.cpp

View File

@ -85,7 +85,8 @@ private:
OBJITER IteObj;
for (IteObj=_oBegin;IteObj!=_oEnd;IteObj++)
{
Box2<ScalarType> Box2D=(*IteObj).BBox();
Box2<ScalarType> Box2D;
(*IteObj).GetBBox(Box2D);
//get index of intersected cells
Point2i minIndex=this->GridP(Box2D.min);
@ -134,12 +135,15 @@ public:
inline void Set(const OBJITER & _oBegin,
const OBJITER & _oEnd)
{
Box2x bbox;
Box2x bbox,ibbox;
OBJITER IteObj;
for (IteObj=_oBegin;IteObj!=_oEnd;IteObj++)
bbox.Add((*IteObj).BBox());
{
(*IteObj).GetBBox(ibbox);
bbox.Add(ibbox);
}
ScalarType diag=bbox.Diag();
bbox.Offset(diag*0.01);
Set<OBJITER>(_oBegin,_oEnd,bbox);

View File

@ -91,12 +91,10 @@ public:
inline PointType MidPoint( ) const
{ return ( _p0 + _p1) / ScalarType(2.0) ; }
/// return the bounding box
inline Box2<ScalarType> BBox( ) const
inline void GetBBox( Box2<ScalarType> &t) const
{
Box2<ScalarType> t;
t.Add(_p0);
t.Set(_p0);
t.Add(_p1);
return t;
}
/// returns segment length
ScalarType Length()