JointContUniformSampler.h
Go to the documentation of this file.00001 /**<!--------------------------------------------------------------------> 00002 @class JointContUniformSampler 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @author Matthew Jacobs (jacobs.mh@gmail.com) 00005 @date Fall 2008 00006 00007 @brief 00008 Represents a uniform distribution on [min,max)^N ; N > 0, 00009 which could be used, for example, for choosing a random UV coordinate 00010 (e.g, where N = 2, min = 0, max = 1) 00011 <!-------------------------------------------------------------------->**/ 00012 00013 #ifndef JOINT_CONT_UNIFORM_SAMPLER_H_ 00014 #define JOINT_CONT_UNIFORM_SAMPLER_H_ 00015 00016 #include "stats/samplers/ContUniformSampler.h" 00017 00018 class JointContUniformSampler : public Sampler { 00019 00020 public: 00021 ///@name Constructors 00022 //@{----------------------------------------------------------------- 00023 00024 inline explicit JointContUniformSampler(unsigned min = 0, 00025 unsigned max = 0, 00026 unsigned dim = 2) 00027 : Sampler(), m_sampler(min, max), 00028 m_dimension(dim) 00029 { } 00030 00031 inline JointContUniformSampler(const JointContUniformSampler ©) 00032 : Sampler(copy), m_sampler(copy.m_sampler), 00033 m_dimension(copy.m_dimension) 00034 { } 00035 00036 virtual ~JointContUniformSampler() 00037 { } 00038 00039 00040 //@}----------------------------------------------------------------- 00041 ///@name Initialization 00042 //@{----------------------------------------------------------------- 00043 00044 /** 00045 * @brief 00046 * Should perform any initialization of this random variable which 00047 * may be necessary to speed or prepare sampling 00048 * 00049 * @note should be called before calling sample or getPdf 00050 * @note default implementation initialiazes this random variable's 00051 * sample space 00052 */ 00053 virtual void init(); 00054 00055 00056 //@}----------------------------------------------------------------- 00057 ///@name Main usage interface 00058 //@{----------------------------------------------------------------- 00059 00060 /** 00061 * @returns a randomly chosen event x, sampled from this random 00062 * variable's sample space 00063 * @note consecutive calls to sample are expected to return 00064 * independent, identically distributed (IID) samples 00065 */ 00066 virtual Event sample(); 00067 00068 /** 00069 * @returns the probability density with which the given event would be 00070 * sampled according to the underlying probability density function 00071 * @note the given event is assumed to lie within this random variable's 00072 * sample space 00073 */ 00074 virtual real_t getPdf(const Event &event) PURE_FUNCTION; 00075 00076 00077 //@}----------------------------------------------------------------- 00078 ///@name Accessors/Mutators 00079 //@{----------------------------------------------------------------- 00080 00081 /** 00082 * @returns the dimension of this distribution 00083 */ 00084 inline unsigned getDimension() const { 00085 return m_dimension; 00086 } 00087 00088 //@}----------------------------------------------------------------- 00089 00090 protected: 00091 ContUniformSampler m_sampler; 00092 00093 unsigned m_dimension; 00094 }; 00095 00096 #endif // JOINT_CONT_UNIFORM_SAMPLER_H_ 00097
Generated on 28 Feb 2009 for Milton by
1.5.6