vcg::Box< N, S > Class Template Reference
[Space]

#include <box.h>

Inheritance diagram for vcg::Box< N, S >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { Dimension = N }
typedef Point< N, S > ParamType
typedef Point< N, S > PointType
 type used as point Type
typedef S ScalarType
 the type used as scalar. Typically, float or double, but char or int are possible too.

Public Member Functions

void Add (const PointType &p)
void Add (Box const &b)
Area () const
 Area() and Volume() are sinonims (a.
 Box (const PointType &mi, const PointType &ma)
 Min Max constructor.
 Box ()
 The box constructor.
PointType Center () const
 Calcola il centro del box.
bool Collide (Box const &b)
Diag () const
 Restituisce la lunghezza della diagonale del box.
PointType GlobalToLocal (PointType const &p) const
 Returns local coords expressed in [0..1]^3 of a point in 3D.
void Inflate (const PointType &delta)
void Inflate (const S s)
void InflateFix (const S s)
void Intersect (const Box &b)
bool IsEmpty () const
bool IsIn (PointType const &p) const
bool IsInEx (PointType const &p) const
bool IsNull () const
PointType LocalToGlobal (PointType const &p) const
 Returns global coords of a local point expressed in [0..1]^3.
PointTypeMax ()
const PointTypeMax () const
PointTypeMin ()
const PointTypeMin () const
bool operator!= (Box const &p) const
 Operator to dispare two boxes.
bool operator== (Box const &p) const
 Operator to compare two boxes.
void Set (const PointType &p)
 Initializing the box.
void SetNull ()
 Set the box to a null value.
PointType Size () const
 Compute box size.
SizeX () const
 Compute box size X.
SizeY () const
 Compute box size Y.
SizeZ () const
 Compute box size Z.
SquaredDiag () const
 Calcola il quadrato della diagonale del box.
void Translate (const PointType &p)
Volume () const
 Computes the Volume for the box.
 ~Box ()
 The box distructor.
Linearity for boxes

Box operator* (const S s) const
Boxoperator*= (const S s)
Box operator+ (Box const &p) const
Boxoperator+= (Box const &p)
Box operator- () const
Box operator- (Box const &p) const
Boxoperator-= (Box const &p)
Box operator/ (const S s) const
Boxoperator/= (const S s)
void Zero ()
 sets a point to Zero

Protected Attributes

Point3< S > _max
 _max coordinate point
Point3< S > _min
 The scalar type.

Iporters (for boxes in different spaces and with different scalar types)



template<int N0, class S0 >
void Import (const Box< N0, S0 > &b)
 imports the box
template<int N0, class S0 >
static Box Construct (const Box< N0, S0 > &b)
 constructs a new ray importing it from an existing one

Detailed Description

template<int N, class S>
class vcg::Box< N, S >

Templated class for 3D boxes. This is the class for definition of a axis aligned box in 2D or 3D space. Typically used as bounding boxes. It is stored just as two Points (at the opposite vertices).

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

Definition at line 66 of file box.h.


Member Typedef Documentation

template<int N, class S>
typedef Point<N,S> vcg::Box< N, S >::ParamType

Definition at line 70 of file box.h.

template<int N, class S>
typedef Point<N,S> vcg::Box< N, S >::PointType

type used as point Type

Reimplemented from vcg::Space< N, S >.

Definition at line 71 of file box.h.

template<int N, class S>
typedef S vcg::Box< N, S >::ScalarType

the type used as scalar. Typically, float or double, but char or int are possible too.

Reimplemented from vcg::Space< N, S >.

Definition at line 69 of file box.h.


Member Enumeration Documentation

template<int N, class S>
anonymous enum
Enumerator:
Dimension 

Definition at line 72 of file box.h.


Constructor & Destructor Documentation

template<int N, class S>
vcg::Box< N, S >::Box (  )  [inline]

The box constructor.

Definition at line 89 of file box.h.

template<int N, class S>
vcg::Box< N, S >::Box ( const PointType mi,
const PointType ma 
) [inline]

Min Max constructor.

Definition at line 95 of file box.h.

template<int N, class S>
vcg::Box< N, S >::~Box (  )  [inline]

The box distructor.

Definition at line 97 of file box.h.


Member Function Documentation

template<int N, class S>
void vcg::Box< N, S >::Add ( const PointType p  )  [inline]

Add a point to a box. The box is modified is the added point is aoutside it.

Parameters:
p The point to add

Definition at line 160 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::Add ( Box< N, S > const &  b  )  [inline]

Add two boxex: Returns minimal box that contains both operands.

Parameters:
b The box to add

Definition at line 150 of file box.h.

template<int N, class S>
S vcg::Box< N, S >::Area (  )  const [inline]

Area() and Volume() are sinonims (a.

Definition at line 291 of file box.h.

template<int N, class S>
PointType vcg::Box< N, S >::Center (  )  const [inline]

Calcola il centro del box.

Definition at line 264 of file box.h.

template<int N, class S>
bool vcg::Box< N, S >::Collide ( Box< N, S > const &  b  )  [inline]

TODO: Move TO COLLIDE!!! Verifica se due box collidono cioe' se hanno una intersezione non vuota. Per esempio due box adiacenti non collidono.

Parameters:
b A box
Returns:
True se collidoo, false altrimenti

Definition at line 239 of file box.h.

template<int N, class S>
template<int N0, class S0 >
static Box vcg::Box< N, S >::Construct ( const Box< N0, S0 > &  b  )  [inline, static]

constructs a new ray importing it from an existing one

Definition at line 367 of file box.h.

template<int N, class S>
S vcg::Box< N, S >::Diag (  )  const [inline]

Restituisce la lunghezza della diagonale del box.

Definition at line 254 of file box.h.

template<int N, class S>
PointType vcg::Box< N, S >::GlobalToLocal ( PointType const &  p  )  const [inline]

Returns local coords expressed in [0..1]^3 of a point in 3D.

Definition at line 277 of file box.h.

template<int N, class S>
template<int N0, class S0 >
void vcg::Box< N, S >::Import ( const Box< N0, S0 > &  b  )  [inline]

imports the box

Definition at line 362 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::Inflate ( const PointType delta  )  [inline]

Enlarges the box dimensions by a fixed delta.

Parameters:
delta Point in D space. If delta > 0 box enlarges. If delta < 0 box reduces.

Definition at line 129 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::Inflate ( const S  s  )  [inline]

Infaltes the box of a percentage..

Parameters:
s Scalar value. E.g if s=0.1 the box enlarges of 10% in every direction if S==0.5 box doubles (+50% in every direction) if S < 0 box shrinks if S==0.5 box reduces to a point

Definition at line 114 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::InflateFix ( const S  s  )  [inline]

Enlarges the box dimensions by k in every direction, with k = bbox.diag*s

Definition at line 120 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::Intersect ( const Box< N, S > &  b  )  [inline]

Coputes intersection of Boxes: the minimal box containing both operands.

Parameters:
b The other operand

Definition at line 178 of file box.h.

template<int N, class S>
bool vcg::Box< N, S >::IsEmpty (  )  const [inline]

Controlla se il box e' vuoto.

Returns:
True se il box e' vuoto, false altrimenti

Definition at line 252 of file box.h.

template<int N, class S>
bool vcg::Box< N, S >::IsIn ( PointType const &  p  )  const [inline]

Check wheter a point is inside box.

Parameters:
p The point
Returns:
True if inside, false otherwise

Definition at line 203 of file box.h.

template<int N, class S>
bool vcg::Box< N, S >::IsInEx ( PointType const &  p  )  const [inline]

Check wheter a point is inside box, open at left and closed at right [min..max)

Parameters:
p The point 3D
Returns:
True if inside, false otherwise

Definition at line 219 of file box.h.

template<int N, class S>
bool vcg::Box< N, S >::IsNull (  )  const [inline]

Controlla se il box e' nullo.

Returns:
True se il box e' nullo, false altrimenti

Definition at line 248 of file box.h.

template<int N, class S>
PointType vcg::Box< N, S >::LocalToGlobal ( PointType const &  p  )  const [inline]

Returns global coords of a local point expressed in [0..1]^3.

Definition at line 270 of file box.h.

template<int N, class S>
PointType& vcg::Box< N, S >::Max (  )  [inline]

Definition at line 84 of file box.h.

template<int N, class S>
const PointType& vcg::Box< N, S >::Max (  )  const [inline]

Definition at line 83 of file box.h.

template<int N, class S>
PointType& vcg::Box< N, S >::Min (  )  [inline]

Definition at line 86 of file box.h.

template<int N, class S>
const PointType& vcg::Box< N, S >::Min (  )  const [inline]

Definition at line 85 of file box.h.

template<int N, class S>
bool vcg::Box< N, S >::operator!= ( Box< N, S > const &  p  )  const [inline]

Operator to dispare two boxes.

Definition at line 104 of file box.h.

template<int N, class S>
Box vcg::Box< N, S >::operator* ( const S  s  )  const [inline]

Definition at line 323 of file box.h.

template<int N, class S>
Box& vcg::Box< N, S >::operator*= ( const S  s  )  [inline]

Definition at line 340 of file box.h.

template<int N, class S>
Box vcg::Box< N, S >::operator+ ( Box< N, S > const &  p  )  const [inline]

Reimplemented from vcg::Linear< Box >.

Definition at line 315 of file box.h.

template<int N, class S>
Box& vcg::Box< N, S >::operator+= ( Box< N, S > const &  p  )  [inline]

Reimplemented from vcg::Linear< Box >.

Definition at line 332 of file box.h.

template<int N, class S>
Box vcg::Box< N, S >::operator- (  )  const [inline]

Reimplemented from vcg::Linear< Box >.

Definition at line 350 of file box.h.

template<int N, class S>
Box vcg::Box< N, S >::operator- ( Box< N, S > const &  p  )  const [inline]

Reimplemented from vcg::Linear< Box >.

Definition at line 319 of file box.h.

template<int N, class S>
Box& vcg::Box< N, S >::operator-= ( Box< N, S > const &  p  )  [inline]

Reimplemented from vcg::Linear< Box >.

Definition at line 336 of file box.h.

template<int N, class S>
Box vcg::Box< N, S >::operator/ ( const S  s  )  const [inline]

Definition at line 327 of file box.h.

template<int N, class S>
Box& vcg::Box< N, S >::operator/= ( const S  s  )  [inline]

Definition at line 344 of file box.h.

template<int N, class S>
bool vcg::Box< N, S >::operator== ( Box< N, S > const &  p  )  const [inline]

Operator to compare two boxes.

Definition at line 99 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::Set ( const PointType p  )  [inline]

Initializing the box.

Definition at line 135 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::SetNull (  )  [inline]

Set the box to a null value.

Definition at line 140 of file box.h.

template<int N, class S>
PointType vcg::Box< N, S >::Size (  )  const [inline]

Compute box size.

Definition at line 295 of file box.h.

template<int N, class S>
S vcg::Box< N, S >::SizeX (  )  const [inline]

Compute box size X.

Definition at line 300 of file box.h.

template<int N, class S>
S vcg::Box< N, S >::SizeY (  )  const [inline]

Compute box size Y.

Definition at line 302 of file box.h.

template<int N, class S>
S vcg::Box< N, S >::SizeZ (  )  const [inline]

Compute box size Z.

Definition at line 304 of file box.h.

template<int N, class S>
S vcg::Box< N, S >::SquaredDiag (  )  const [inline]

Calcola il quadrato della diagonale del box.

Definition at line 259 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::Translate ( const PointType p  )  [inline]

Traslalate the box.

Parameters:
p,: the translation vector

Definition at line 194 of file box.h.

template<int N, class S>
S vcg::Box< N, S >::Volume (  )  const [inline]

Computes the Volume for the box.

Definition at line 285 of file box.h.

template<int N, class S>
void vcg::Box< N, S >::Zero (  )  [inline]

sets a point to Zero

Definition at line 310 of file box.h.


Member Data Documentation

template<int N, class S>
Point3<S> vcg::Box< N, S >::_max [protected]

_max coordinate point

Definition at line 79 of file box.h.

template<int N, class S>
Point3<S> vcg::Box< N, S >::_min [protected]

The scalar type.

_min coordinate point

Definition at line 77 of file box.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


vcglib
Author(s): Christian Bersch
autogenerated on Fri Jan 11 09:22:58 2013