gk::BBox Class Reference

representation d'une boite englobante alignee sur les axes (aabox). More...

#include <Geometry.h>

List of all members.

Public Member Functions

 BBox ()
 constructeur par defaut.
void clear ()
 re-initialise les extremites.
 BBox (const Point &p)
 construction de l'aabbox d'un point, cf. Union( aabox, q ) pour ajouter d'autres points.
 BBox (const Point &p1, const Point &p2)
 construction d'une aabox connaissant 2 points.
void print () const
void Union (const BBox &bbox)
 ajoute une autre aabox
void Union (const Point &p)
 ajoute un point a la bbox.
bool Overlaps (const BBox &b) const
 verifie l'intersection de 2 aabbox.
void Intersection (const BBox &b)
bool isEmpty () const
bool Inside (const Point &pt) const
 verifie l'inclusion d'un point dans l'aabox.
void Expand (float delta)
 dilate l'aabox de 'delta' dans toutes les directions.
const Point getCenter () const
 renvoie le centre de la boite.
void getCenter (Point &center) const
 renvoie le centre de la boite
float Volume () const
 renvoie le volume de l'aabox.
float SurfaceArea () const
 renvoie l'aire de l'aabox
int MaximumExtent () const
 renvoie l'indice de l'axe le plus long de l'aabox, 0 pour X, 1 pour Y et 2 pour Z.
void BoundingSphere (Point &c, float &r) const
 renvoie une sphere englobante de l'aabox.
bool Intersect (const Ray &ray, const float htmax, float &rtmin, float &rtmax) const
 intersection avec rayon.
bool Occluded (const Ray &ray) const
bool Occluded (const Ray &ray, const float tmax) const
bool Intersect (const Ray &ray, const float htmax, float &rtmin, float &rtmax, Normal &rn) const
 renvoie egalement la normale de l'intersection.
Pointoperator[] (const int id)
 acces indexe aux extremes de l'aabox.
const Pointoperator[] (const int id) const
 acces indexe aux extremes de l'aabox.

Public Attributes

Point pMin
 points extremes de l'aabox.
Point pMax

Friends

std::ostream & operator<< (std::ostream &os, const BBox &b)
BBox Union (const BBox &b, const Point &p)
 ajoute un point dans l'aabox.
BBox Union (const BBox &b, const BBox &b2)
 ajoute une autre aabox.
BBox Intersection (const BBox &a, const BBox &b)

Detailed Description

representation d'une boite englobante alignee sur les axes (aabox).


Member Function Documentation

bool gk::BBox::Intersect ( const Ray ray,
const float  htmax,
float &  rtmin,
float &  rtmax 
) const [inline]

intersection avec rayon.

renvoie faux si une intersection existe mais n'est pas dans l'intervalle [0 htmax].
renvoie vrai + la position du point d'entree (rtmin) et celle du point de sortie (rtmax).

"An Efficient and Robust Ray-Box Intersection Algorithm" cf http://cag.csail.mit.edu/%7Eamy/papers/box-jgt.pdf

le parametre htmax permet de trouver tres facilement l'intersection la plus proche de l'origine du rayon.

        float t= ray.tmax;      // ou t= HUGE_VAL; la plus grande distance le long du rayon.
        // rechercher la bbox la plus proche de l'origine du rayon
        for(int i= 0; i < n; i++)
        {
            float tmin;
            float tmax;
            if(bbox[i].Intersect(ray, t, tmin, tmax))
                // t= tmin; ne suffit pas si l'intervalle [tmin tmax] est en partie negatif, tmin < 0
                t= std::max(0.f, tmin);
        }

References gk::Ray::inv_d, gk::Ray::o, gk::Ray::sign_d, and gk::Vector::x.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Friends
Generated on Mon Jan 9 15:57:18 2012 for gKitGL by  doxygen 1.6.3