$darkmode
VCG Library
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
vcg::Box3< BoxScalarType > Class Template Reference

#include <box3.h>

Public Types

typedef BoxScalarType ScalarType
 The scalar type.
 

Public Member Functions

 Box3 ()
 The bounding box constructor.
 
 Box3 (const Point3< BoxScalarType > &mi, const Point3< BoxScalarType > &ma)
 Min Max constructor.
 
 Box3 (const Point3< BoxScalarType > &center, const BoxScalarType &radius)
 Point Radius Constructor.
 
 ~Box3 ()
 The bounding box distructor.
 
bool operator== (const Box3< BoxScalarType > &p) const
 Operator to compare two bounding box.
 
bool operator!= (const Box3< BoxScalarType > &p) const
 Operator to dispare two bounding box.
 
void Offset (const BoxScalarType s)
 
void Offset (const Point3< BoxScalarType > &delta)
 
void Set (const Point3< BoxScalarType > &p)
 Initializing the bounding box.
 
void SetNull ()
 Set the bounding box to a null value.
 
void Add (const Box3< BoxScalarType > &b)
 
void Add (const Point3< BoxScalarType > &p)
 
void Add (const Point3< BoxScalarType > &p, const BoxScalarType radius)
 
void Add (const Matrix44< BoxScalarType > &m, const Box3< BoxScalarType > &b)
 
void Intersect (const Box3< BoxScalarType > &b)
 
void Translate (const Point3< BoxScalarType > &p)
 
bool IsIn (const Point3< BoxScalarType > &p) const
 
bool IsInEx (const Point3< BoxScalarType > &p) const
 
bool Collide (const Box3< BoxScalarType > &b) const
 
bool IsNull () const
 
bool IsEmpty () const
 
BoxScalarType Diag () const
 Return the lenght of the diagonal of the box .
 
BoxScalarType SquaredDiag () const
 Calcola il quadrato della diagonale del bounding box.
 
Point3< BoxScalarType > Center () const
 Return the center of the box.
 
Point3< BoxScalarType > Dim () const
 Compute bounding box size.
 
Point3< BoxScalarType > LocalToGlobal (const Point3< BoxScalarType > &p) const
 Returns global coords of a local point expressed in [0..1]^3.
 
Point3< BoxScalarType > GlobalToLocal (const Point3< BoxScalarType > &p) const
 Returns local coords expressed in [0..1]^3 of a point in 3D.
 
BoxScalarType Volume () const
 Return the volume of the box.
 
BoxScalarType DimX () const
 Calcola la dimensione del bounding box sulla x.
 
BoxScalarType DimY () const
 Calcola la dimensione del bounding box sulla y.
 
BoxScalarType DimZ () const
 Calcola la dimensione del bounding box sulla z.
 
unsigned char MaxDim () const
 Calcola il lato di lunghezza maggiore.
 
unsigned char MinDim () const
 Calcola il lato di lunghezza minore.
 
template<class Q >
void Import (const Box3< Q > &b)
 
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),(x,Y,Z),(X,Y,Z)
 

Static Public Member Functions

template<class Q >
static Box3 Construct (const Box3< Q > &b)
 

Public Attributes

Point3< BoxScalarType > min
 min coordinate point
 
Point3< BoxScalarType > max
 max coordinate point
 

Detailed Description

template<class BoxScalarType>
class vcg::Box3< BoxScalarType >

Templated class for 3D boxes. This is the class for definition of a axis aligned bounding box in 3D space. It is stored just as two Point3

Parameters
BoxScalarType(template parameter) Specifies the type of scalar used to represent coords.

The templated class for representing a point in 3D space. The class is templated over the ScalarType class that is used to represent coordinates. All the usual operator overloading (* + - ...) is present.

Member Function Documentation

◆ Add() [1/4]

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Add ( const Box3< BoxScalarType > &  b)
inline

Modify the current bbox to contain also the passed box. Adding a null bounding box does nothing

◆ Add() [2/4]

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Add ( const Matrix44< BoxScalarType > &  m,
const Box3< BoxScalarType > &  b 
)
inline

Modify the current bbox to contain also the box b transformed according to the matrix m

◆ Add() [3/4]

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Add ( const Point3< BoxScalarType > &  p)
inline

Modify the current bbox to contain also the passed point

◆ Add() [4/4]

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Add ( const Point3< BoxScalarType > &  p,
const BoxScalarType  radius 
)
inline

Modify the current bbox to contain also the passed sphere

◆ Collide()

template<class BoxScalarType >
bool vcg::Box3< BoxScalarType >::Collide ( const Box3< BoxScalarType > &  b) const
inline

Verifica se due bounding box collidono cioe' se hanno una intersezione non vuota. Per esempio due bounding box adiacenti non collidono.

Parameters
bA bounding box
Returns
True se collidoo, false altrimenti

◆ Intersect()

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Intersect ( const Box3< BoxScalarType > &  b)
inline

Calcola l'intersezione tra due bounding box. Al bounding box viene assegnato il valore risultante.

Parameters
bIl bounding box con il quale si vuole effettuare l'intersezione

◆ IsEmpty()

template<class BoxScalarType >
bool vcg::Box3< BoxScalarType >::IsEmpty ( ) const
inline

return true if the box is empty (e.g. if min == max)

◆ IsIn()

template<class BoxScalarType >
bool vcg::Box3< BoxScalarType >::IsIn ( const Point3< BoxScalarType > &  p) const
inline

true if the point belong to the closed box

◆ IsInEx()

template<class BoxScalarType >
bool vcg::Box3< BoxScalarType >::IsInEx ( const Point3< BoxScalarType > &  p) const
inline

true if the point belong to the open box (open on the max side) e.g. if p in [min,max)

◆ IsNull()

template<class BoxScalarType >
bool vcg::Box3< BoxScalarType >::IsNull ( ) const
inline

return true if the box is null (e.g. invalid or not initialized);

◆ Offset() [1/2]

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Offset ( const BoxScalarType  s)
inline

Offset of a vector (s,s,s)

◆ Offset() [2/2]

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Offset ( const Point3< BoxScalarType > &  delta)
inline

Offset the two corner of the box of a vector delta. adding delta to max and -delta to min.

Parameters
deltaoffset vector

◆ Translate()

template<class BoxScalarType >
void vcg::Box3< BoxScalarType >::Translate ( const Point3< BoxScalarType > &  p)
inline

Trasla il bounding box di un valore definito dal parametro.

Parameters
pIl bounding box trasla sulla x e sulla y in base alle coordinate del parametro

The documentation for this class was generated from the following file: