From 47334c555dacbe74e9ff195c66998bfb542b60df Mon Sep 17 00:00:00 2001 From: cignoni Date: Sun, 12 Jun 2016 21:10:46 +0000 Subject: [PATCH] Small change to make the bbox function in segment equal to the other vcg object (getbbox instead of bbox) --- apps/sample/space_index_2d/space_index_2d.cpp | 12 +++++++----- apps/sample/space_index_2d/space_index_2d.pro | 14 +++----------- vcg/space/index/grid_static_ptr2d.h | 12 ++++++++---- vcg/space/segment2.h | 6 ++---- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/apps/sample/space_index_2d/space_index_2d.cpp b/apps/sample/space_index_2d/space_index_2d.cpp index 0902e26e..a2d731e6 100644 --- a/apps/sample/space_index_2d/space_index_2d.cpp +++ b/apps/sample/space_index_2d/space_index_2d.cpp @@ -169,11 +169,13 @@ MySegmentType * DoRay(MyRayType & _r, void GetInBoxSegmentsBruteF( vcg::Box2 bbox, std::vector &result) { - for (size_t i=0;i ibbox; + for (size_t i=0;i Box2D=(*IteObj).BBox(); + Box2 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(_oBegin,_oEnd,bbox); diff --git a/vcg/space/segment2.h b/vcg/space/segment2.h index 3e439a86..37ce7310 100644 --- a/vcg/space/segment2.h +++ b/vcg/space/segment2.h @@ -91,12 +91,10 @@ public: inline PointType MidPoint( ) const { return ( _p0 + _p1) / ScalarType(2.0) ; } /// return the bounding box - inline Box2 BBox( ) const + inline void GetBBox( Box2 &t) const { - Box2 t; - t.Add(_p0); + t.Set(_p0); t.Add(_p1); - return t; } /// returns segment length ScalarType Length()