gk::PTNTriangle Struct Reference

representation d'un triangle 'geometrique'. More...

#include <PTNTriangle.h>

Inheritance diagram for gk::PTNTriangle:
gk::PNTriangle gk::Triangle

List of all members.

Public Member Functions

 PTNTriangle ()
 constructeur par defaut.
 PTNTriangle (const Point &_a, const Normal &_na, const Point2 &_ta, const Point &_b, const Normal &_nb, const Point2 &_tb, const Point &_c, const Normal &_nc, const Point2 &_tc)
 construit un triangle connaissant ses 3 sommets.
 ~PTNTriangle ()
 destructeur.
PTNTriangle transform (const Transform &t)
 renvoie un pntriangle transforme par 't'.
Triangle getBaseTriangle ()
 renvoie le triangle geometrique
Triangle getPNTriangle ()
 renvoie le pn triangle.
Normal getUVNormal (const float u, const float v) const
 renvoie une normale a l'interieur du triangle connaissant ses coordonnees barycentriques.
float getArea () const
Normal getNormal () const
Vector local (const Vector &v) const
 changement de repere, renvoie le vecteur dans le repere local (bitangent, tangent, normal)
Vector world (const Vector &v) const
 changement de repere, renvoie le vecteur dans le repere global.
BBox getBBox () const
bool Intersect (const Ray &ray, const float htmax, float &rt, float &ru, float &rv) const
 intersection avec un rayon.
Point getUVPoint (const float u, const float v) const
 renvoie un point a l'interieur du triangle connaissant ses coordonnees barycentriques.
float sampleUniform (Sampler &sampler, Point &p) const
 choisit un point aleatoirement a la surface du triangle et renvoie la probabilite de l'avoir choisi.
float pdfUniform (const Point &p) const
 renvoie la probabilite de choisir le point p aleatoirement.

Public Attributes

Point2 ta
Point2 tb
Point2 tc
Normal na
Normal nb
Normal nc
Point a
Point b
Point c
float area

Detailed Description

representation d'un triangle 'geometrique'.


Member Function Documentation

Normal gk::PNTriangle::getUVNormal ( const float  u,
const float  v 
) const [inline, inherited]

renvoie une normale a l'interieur du triangle connaissant ses coordonnees barycentriques.

convention n(u, v)= (1 - u - v) * na + u * nb + v * nc.

bool gk::Triangle::Intersect ( const Ray ray,
const float  htmax,
float &  rt,
float &  ru,
float &  rv 
) const [inline, inherited]

intersection avec un rayon.

renvoie faux s'il n'y a pas d'intersection valide, une intersection peut exister mais peut ne pas se trouver dans l'intervalle [0 htmax] du rayon.
renvoie vrai + les coordonnees barycentriques (ru, rv) du point d'intersection + sa position le long du rayon (rt).
convention barycentrique : t(u, v)= (1 - u - v) * a + u * b + v * c
utiliser Mesh::getUVNormal() et Mesh::getUVTexCoord() pour interpoler les attributs du point d'intersection.
ou PNTriangle::getUVNormal().

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 le triangle le plus proche de l'origine du rayon
        for(int i= 0; i < n; i++)
        {
            float rt;
            float ru, rv;
            if(triangle[i].Intersect(ray, t, rt, ru, rv))
                t= rt;
        }

References gk::Cross(), gk::Ray::d, gk::Dot(), and gk::Ray::o.

Point gk::Triangle::getUVPoint ( const float  u,
const float  v 
) const [inline, inherited]

renvoie un point a l'interieur du triangle connaissant ses coordonnees barycentriques.

convention p(u, v)= (1 - u - v) * a + u * b + v * c

float gk::Triangle::pdfUniform ( const Point p  )  const [inline, inherited]

renvoie la probabilite de choisir le point p aleatoirement.

remarque: le point doit appartenir au triangle.


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