Projection.h

Go to the documentation of this file.
00001 /* $Id:$ */
00002 
00003 #ifndef __PROJECTION_H
00004 #define __PROJECTION_H
00005 
00006 #include <gra/GRAObject.h>
00007 
00021 using namespace esg;
00022 
00023 namespace gra {
00024 
00025 class GRA_EXPORT Projection : public GRAObject {
00026 protected:
00027     Matrix4 _projMat;     // projection matrix
00028     float   _left;
00029     float   _right;
00030     float   _bottom;
00031     float   _top;
00032     float   _near;
00033     float   _far;
00034 
00035 protected:
00036     void _set_clipping_planes(double /* left   */, double /* right */,
00037                               double /* bottom */, double /* top   */,
00038                               double /* near   */, double /* far   */);
00039 
00040 public:
00047     Projection(double /* left   */, double /* right */,
00048                double /* bottom */, double /* top   */,
00049                double /* near   */, double /* far   */);
00050     Projection(const Projection&);
00051 
00057     virtual Projection* clone() const = 0;
00058 
00064     void set(const Projection& /* proj */);
00065 
00073     Vector4 project(const Vector4& /* 3Dpoint */) const;
00074     Vector3 project(const Vector3& /* 3Dpoint */) const;
00075 
00084     bool projectAndClip(const Vector4& /* 3Dpoint */,
00085                               Vector4* /* res     */) const;
00086     bool projectAndClip(const Vector3& /* 3Dpoint */,
00087                               Vector3* /* res     */) const;
00088 
00102     bool projectToPlane(const Vector3& /* 3Dpoint */,
00103                               Vector2& /* 2Dpoint */) const;
00104 
00113     bool clip(const Vector4& /* 3Dpoint */) const;
00114     bool clip(const Vector3& /* 3Dpoint */) const;
00115 
00119     inline float getLeftPlane   (void) const { return _left;          }
00120     inline float getRightPlane  (void) const { return _right;         }
00121     inline float getBottomPlane (void) const { return _bottom;        }
00122     inline float getTopPlane    (void) const { return _top;           }
00123     inline float getNearPlane   (void) const { return _near;          }
00124     inline float getFarPlane    (void) const { return _far;           }
00125     inline float getPlaneWidth  (void) const { return _right - _left; }
00126     inline float getPlaneHeight (void) const { return _top - _bottom; }
00127 
00131     void getProjectionArea(Vector3&, /* lower-left corner  */
00132                            Vector3&, /* upper-left corner  */
00133                            Vector3&, /* upper-right corner */
00134                            Vector3&  /* lower-right corner */) const;
00135 
00143     virtual Vector3 getProjectionDirection(const Vector2& /* 2Dpoint */) = 0;
00144 };
00145     
00146 } // namespace
00147 
00148 #endif // __PROJECTION_H

Generated on Tue Nov 21 15:11:42 2006 for gra by  doxygen 1.4.6