26 #include <vcg/space/point3.h>
27 #include <vcg/math/matrix44.h>
28 #include <vcg/space/line3.h>
29 #include <vcg/space/plane3.h>
40 template <
class BoxScalarType>
126 if(
min.X() > p.X())
min.X() = p.X();
127 if(
min.Y() > p.Y())
min.Y() = p.Y();
128 if(
min.Z() > p.Z())
min.Z() = p.Z();
130 if(
max.X() < p.X())
max.X() = p.X();
131 if(
max.Y() < p.Y())
max.Y() = p.Y();
132 if(
max.Z() < p.Z())
max.Z() = p.Z();
143 min.X() = std::min(
min.X(),p.X()-radius);
144 min.Y() = std::min(
min.Y(),p.Y()-radius);
145 min.Z() = std::min(
min.Z(),p.Z()-radius);
147 max.X() = std::max(
max.X(),p.X()+radius);
148 max.Y() = std::max(
max.Y(),p.Y()+radius);
149 max.Z() = std::max(
max.Z(),p.Z()+radius);
197 min.X() <= p.X() && p.X() <=
max.X() &&
198 min.Y() <= p.Y() && p.Y() <=
max.Y() &&
199 min.Z() <= p.Z() && p.Z() <=
max.Z()
208 min.X() <= p.X() && p.X() <
max.X() &&
209 min.Y() <= p.Y() && p.Y() <
max.Y() &&
210 min.Z() <= p.Z() && p.Z() <
max.Z()
247 return SquaredDistance(
min,
max);
289 if(diag[0]>diag[1]) i=0;
else i=1;
290 return (diag[i]>diag[2])? i: 2;
296 if(diag[0]<diag[1]) i=0;
else i=1;
297 return (diag[i]<diag[2])? i: 2;
301 inline void Import(
const Box3<Q> & b )
308 static inline Box3 Construct(
const Box3<Q> & b )
310 return Box3(Point3<BoxScalarType>::Construct(b.min),Point3<BoxScalarType>::Construct(b.max));
322 template <
class T> Box3<T> Point3<T>::GetBBox(Box3<T> &bb)
const {
328 typedef Box3<short> Box3s;
329 typedef Box3<int> Box3i;
330 typedef Box3<float> Box3f;
331 typedef Box3<double> Box3d;
Point3< BoxScalarType > GlobalToLocal(const Point3< BoxScalarType > &p) const
Returns local coords expressed in [0..1]^3 of a point in 3D.
Definition: box3.h:267
Box3()
The bounding box constructor.
Definition: box3.h:53
void Add(const Point3< BoxScalarType > &p, const BoxScalarType radius)
Definition: box3.h:138
bool IsNull() const
Definition: box3.h:235
BoxScalarType DimY() const
Calcola la dimensione del bounding box sulla y.
Definition: box3.h:282
Point3< BoxScalarType > P(int i) const
gives the ith box vertex in order: (x,y,z),(X,y,z),(x,Y,z),(X,Y,z),(x,y,Z),(X,y,Z),...
Definition: box3.h:314
bool IsIn(const Point3< BoxScalarType > &p) const
Definition: box3.h:194
bool IsEmpty() const
Definition: box3.h:238
bool IsInEx(const Point3< BoxScalarType > &p) const
Definition: box3.h:205
void Offset(const Point3< BoxScalarType > &delta)
Definition: box3.h:83
BoxScalarType SquaredDiag() const
Calcola il quadrato della diagonale del bounding box.
Definition: box3.h:245
void Set(const Point3< BoxScalarType > &p)
Initializing the bounding box.
Definition: box3.h:89
Point3< BoxScalarType > max
max coordinate point
Definition: box3.h:51
Box3(const Point3< BoxScalarType > ¢er, const BoxScalarType &radius)
Point Radius Constructor.
Definition: box3.h:57
void Add(const Box3< BoxScalarType > &b)
Definition: box3.h:104
bool operator!=(const Box3< BoxScalarType > &p) const
Operator to dispare two bounding box.
Definition: box3.h:69
Point3< BoxScalarType > Dim() const
Compute bounding box size.
Definition: box3.h:255
void Translate(const Point3< BoxScalarType > &p)
Definition: box3.h:187
~Box3()
The bounding box distructor.
Definition: box3.h:62
Point3< BoxScalarType > Center() const
Return the center of the box.
Definition: box3.h:250
void Intersect(const Box3< BoxScalarType > &b)
Definition: box3.h:172
Box3(const Point3< BoxScalarType > &mi, const Point3< BoxScalarType > &ma)
Min Max constructor.
Definition: box3.h:55
BoxScalarType DimZ() const
Calcola la dimensione del bounding box sulla z.
Definition: box3.h:284
bool operator==(const Box3< BoxScalarType > &p) const
Operator to compare two bounding box.
Definition: box3.h:64
void Offset(const BoxScalarType s)
Definition: box3.h:75
void SetNull()
Set the bounding box to a null value.
Definition: box3.h:95
BoxScalarType Volume() const
Return the volume of the box.
Definition: box3.h:275
bool Collide(const Box3< BoxScalarType > &b) const
Definition: box3.h:226
Point3< BoxScalarType > LocalToGlobal(const Point3< BoxScalarType > &p) const
Returns global coords of a local point expressed in [0..1]^3.
Definition: box3.h:260
void Add(const Point3< BoxScalarType > &p)
Definition: box3.h:121
BoxScalarType DimX() const
Calcola la dimensione del bounding box sulla x.
Definition: box3.h:280
BoxScalarType ScalarType
The scalar type.
Definition: box3.h:46
void Add(const Matrix44< BoxScalarType > &m, const Box3< BoxScalarType > &b)
Definition: box3.h:154
unsigned char MaxDim() const
Calcola il lato di lunghezza maggiore.
Definition: box3.h:286
Point3< BoxScalarType > min
min coordinate point
Definition: box3.h:49
BoxScalarType Diag() const
Return the lenght of the diagonal of the box .
Definition: box3.h:240
unsigned char MinDim() const
Calcola il lato di lunghezza minore.
Definition: box3.h:293
Definition: namespaces.dox:6