From 6b6ffccf46576b01fddf3466bf639797bf7a795a Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 20 Jul 2004 23:10:01 +0000 Subject: [PATCH] Uncommented Add of matrix transformed bbox --- vcg/space/box3.h | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/vcg/space/box3.h b/vcg/space/box3.h index 0f2cebc4..0b1658f8 100644 --- a/vcg/space/box3.h +++ b/vcg/space/box3.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.7 2004/07/15 09:47:55 ganovelli +added function P(int i) to list the box's vertices + Revision 1.6 2004/07/07 23:26:25 cignoni removed the infamous Inflate. Now only Offset exists @@ -50,6 +53,8 @@ First working release. #define __VCGLIB_BOX3 #include +#include + namespace vcg { @@ -152,21 +157,21 @@ public: if(max.Z() < p.Z()) max.Z() = p.Z(); } } - // - //// Aggiunge ad un box un altro box trasformato secondo la matrice m - //void Add( const Matrix44 &m, const Box3 & b ) - //{ - // const Point3 &mn= b.min; - // const Point3 &mx= b.max; - // Add(m.Apply(Point3(mn[0],mn[1],mn[2]))); - // Add(m.Apply(Point3(mx[0],mn[1],mn[2]))); - // Add(m.Apply(Point3(mn[0],mx[1],mn[2]))); - // Add(m.Apply(Point3(mx[0],mx[1],mn[2]))); - // Add(m.Apply(Point3(mn[0],mn[1],mx[2]))); - // Add(m.Apply(Point3(mx[0],mn[1],mx[2]))); - // Add(m.Apply(Point3(mn[0],mx[1],mx[2]))); - // Add(m.Apply(Point3(mx[0],mx[1],mx[2]))); - //} + + // Aggiunge ad un box un altro box trasformato secondo la matrice m + void Add( const Matrix44 &m, const Box3 & b ) + { + const Point3 &mn= b.min; + const Point3 &mx= b.max; + Add(m*(Point3(mn[0],mn[1],mn[2]))); + Add(m*(Point3(mx[0],mn[1],mn[2]))); + Add(m*(Point3(mn[0],mx[1],mn[2]))); + Add(m*(Point3(mx[0],mx[1],mn[2]))); + Add(m*(Point3(mn[0],mn[1],mx[2]))); + Add(m*(Point3(mx[0],mn[1],mx[2]))); + Add(m*(Point3(mn[0],mx[1],mx[2]))); + Add(m*(Point3(mx[0],mx[1],mx[2]))); + } /** Calcola l'intersezione tra due bounding box. Al bounding box viene assegnato il valore risultante. @param b Il bounding box con il quale si vuole effettuare l'intersezione */