representation d'un triangle pour la construction efficace d'une partition sah l'operation la plus frequente est l'obtention de la boite englobante du triangle et de son centre, pMin, pMax representent les points extremes de la bbox, et p stocke les autres coordonnees, shuffle indexe pour chaque sommet dans quel point (pMin, pMax, p) se trouve chaque composante More...
#include <TriangleBox.h>
Public Types | |
enum | { X_MASK = 2+1, Y_MASK = 8+4, Z_MASK = 32+16 } |
enum | { X_SHIFT = 0, Y_SHIFT = 2, Z_SHIFT = 4 } |
enum | { PMIN_ID = 0, PMAX_ID = 1, P_ID = 2 } |
Public Member Functions | |
gk::Point | vertex (const unsigned int v) const |
retrouve les composantes d'un sommet du triangle. | |
gk::Point | a () const |
renvoie le sommet a du triangle abc. | |
gk::Point | b () const |
renvoie le sommet b du triangle abc. | |
gk::Point | c () const |
renvoie le sommet c du triangle abc. | |
unsigned int | get_shuffle (const unsigned int shift, const float v, const float min, const float max, float &p) |
void | init (const gk::Point &a, const gk::Point &b, const gk::Point &c) |
TriangleBox () | |
constructeur par defaut. | |
TriangleBox (const gk::Point &_a, const gk::Point &_b, const gk::Point &_c, const unsigned int _id=-1) | |
construit un triangle connaissant ses 3 sommets. | |
TriangleBox (const gk::Triangle &triangle, const unsigned int _id=-1) | |
construit un triangle a partir d'un triangle 'geometrique'. | |
~TriangleBox () | |
destructeur. | |
gk::BBox | getBBox () const |
renvoie la bbox du triangle. | |
float | getBBoxCenter (const int axis) const |
renvoie une composante du centre de la bbox du triangle. | |
bool | Intersect (const gk::BasicRay &ray, const float htmax, float &rt, float &ru, float &rv) const |
intersection avec un rayon. | |
Public Attributes | |
gk::Point | pMin |
gk::Point | pMax |
gk::Point | p |
unsigned char | shuffle [4] |
representation d'un triangle pour la construction efficace d'une partition sah l'operation la plus frequente est l'obtention de la boite englobante du triangle et de son centre, pMin, pMax representent les points extremes de la bbox, et p stocke les autres coordonnees, shuffle indexe pour chaque sommet dans quel point (pMin, pMax, p) se trouve chaque composante
bool gk::TriangleBox::Intersect | ( | const gk::BasicRay & | ray, |
const float | htmax, | ||
float & | rt, | ||
float & | ru, | ||
float & | rv | ||
) | const [inline] |
intersection avec un rayon.
renvoie faux s'il n'y a pas d'intersection, une intersection peut exister mais peut ne pas se trouver dans [tmin tmax] du rayon. renvoie vrai + les coordonnees barycentriques du point d'intersection + sa position le long du rayon. convention barycentrique : t(u, v)= (1 - u - v) * a + u * b + v * c
"Fast, Minimum Storage Ray/Triangle Intersection" cf http://www.acm.org/jgt/papers/MollerTrumbore97/
References a(), b(), c(), and gk::RTTriangle::Intersect().