Hemisphere.h

Go to the documentation of this file.
00001 /* $Id:$ */
00002 
00003 #ifndef __HEMISPHERE_H
00004 #define __HEMISPHERE_H
00005 
00006 #include <esg/geometry/Sphere.h>
00007 
00008 namespace esg {
00009 
00014 class Hemisphere : public Sphere {
00015 protected:
00016         Vector3 _xAxis, _yAxis, _zAxis;
00017         bool    _backfaceCulling;
00018 
00019 protected:
00020         virtual Mesh* _mesh      (int /* density */) const; 
00021         virtual void  _duplicate_attributes (const Geometry&);
00022         virtual void  _rotateX   (float /* angle */);
00023         virtual void  _rotateY   (float /* angle */);
00024         virtual void  _rotateZ   (float /* angle */);
00025         virtual void  _rotate    (float /* angle */, const Vector3& /* axis */);
00026         virtual void  _rotate    (const Matrix3&);
00027         virtual void  _transform (const Matrix4&);
00028     
00029 public:
00038         Hemisphere (const Vector3& c,
00039                     float          r,
00040                     const Vector3& z,
00041                     bool           bfc = false);
00042 
00049         Hemisphere (const Vector3& z, bool bfc = false);
00050 
00056         Hemisphere (bool bfc = false);
00057 
00058         virtual void rayIntersection (PointEnv*      pPE,
00059                                       int            mask,
00060                                       const Vector3& origin,
00061                                       const Vector3& direction,
00062                                       float          maxD = MAXFLOAT);
00063 
00064         virtual bool mapToUV (const Vector3& v, Vector2& uv);
00065 
00066 
00067 
00068         virtual void randomSample (int mask, PointEnv& pe, double* pdf);
00069 
00070         virtual bool randomDirection (const Vector3& pov,
00071                                       Vector3&       dir,
00072                                       double*        pdf);
00073 
00074         virtual Interval extent (const Vector3& direction) const;
00075 
00076         //virtual Vector3 centroid (void) const; // to change?
00077 
00078         virtual double radius (const Vector3& centroid) const;
00079 
00080         virtual Geometry* clone (const Matrix4* pTrMat) const;
00081 
00082         virtual bool separation (Geometry& geom, Vector3*  pDir); // TO DO
00083 
00084         virtual double distance (const Geometry& geom, Vector3* pDir); // TO DO
00085 
00086         virtual void dump (const char* intent, const char* tab);
00087 
00091         Vector3 getZenith(void) const { return _zAxis; }
00092 
00096         void setZenith(const Vector3& zenith);
00097 
00098     
00106         inline Vector3 world2local3D(const Vector3& dir) const {
00107             return Vector3(dir.x*_xAxis.x + dir.y*_xAxis.y + dir.z*_xAxis.z,
00108                            dir.x*_yAxis.x + dir.y*_yAxis.y + dir.z*_yAxis.z,
00109                            dir.x*_zAxis.x + dir.y*_zAxis.y + dir.z*_zAxis.z);
00110         }
00111 
00119         Vector2 world2local2D(const Vector3& dir) const;
00120 
00121 
00162         Vector3 sampleUniformly(double  elevationRand,
00163                                 double  azimuthRand,
00164                                 double* pPDFval) const;
00165 
00185         Vector2 sampleUniformly2D(double  elevationRand,
00186                                   double  azimuthRand,
00187                                   double* pPDFval) const;
00188 
00201         Vector2 dir2uvUniformly(const Vector3& dir) const;
00202 
00222         Vector3 samplePriorToZenith(double  elevationRand,
00223                                     double  azimuthRand,
00224                                     double* pPDFVal) const;
00225 
00246         Vector2 samplePriorToZenith2D(double  elevationRand,
00247                                       double  azimuthRand,
00248                                       double* pPDFVal) const;
00249 
00261         Vector2 dir2uvPriorToZenith(const Vector3& dir) const;
00262 
00283         Vector3 samplePriorToPoweredZenith(double  elevationRand,
00284                                            double  azimuthRand,
00285                                            int     power,
00286                                            double* pPDFVal) const;
00287 
00309         Vector2 samplePriorToPoweredZenith2D(double  elevationRand,
00310                                              double  azimuthRand,
00311                                              int     power,
00312                                              double* pPDFVal) const;
00313 
00326         Vector2 dir2uvPriorToPoweredZenith(const Vector3& dir,int power) const;
00327 };
00328 
00329 }; // namespace
00330 
00331 #endif // __HEMISPHERE_H

Generated on Wed Jun 28 12:24:28 2006 for esg by  doxygen 1.4.6