gk::Cdf Class Reference

construction d'une fonction de repartition et choix aleatoire d'un element en fonction de la fonction de repartition. More...

#include <Cdf.h>

List of all members.

Public Member Functions

 Cdf (const int reserve=0)
 constructeur, indique le nombre d'elements (optionnel).
void insert (const float v)
 insere un element dans la fonction de repartition.
float sampleSlow (int &id) const
 choisit un element, renvoie son indice et la probabilite de l'avoir choisi.
float sample (Sampler &sampler, int &id) const
 choisit un element, renvoie son indice et la probabilite de l'avoir choisi.
float pdf (const int id) const
 renvoie la probabilite d'avoir selectionne un element.
float sampleUniform (Sampler &sampler, int &id) const
 choisit un element uniformement, renvoie son indice et la probabilite de l'avoir choisi.
float pdfUniform (const int id) const
 renvoie la probabilite d'avoir selection un element.

Detailed Description

construction d'une fonction de repartition et choix aleatoire d'un element en fonction de la fonction de repartition.


Member Function Documentation

float gk::Cdf::sampleSlow ( int &  id  )  const [inline]

choisit un element, renvoie son indice et la probabilite de l'avoir choisi.

utilise une recherche lineaire.

float gk::Cdf::sample ( Sampler sampler,
int &  id 
) const [inline]

choisit un element, renvoie son indice et la probabilite de l'avoir choisi.

utilise une recherche dichotomique dans l'ensemble de valeurs strictement croissant.

References gk::Sampler::uniformFloat().


The documentation for this class 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