Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

basis.h

Go to the documentation of this file.
00001 /*
00002     toxic - A Global Illumination Renderer
00003     Copyright (C) 2003-2004 Francois Beaune
00004     Contact: http://toxicengine.sourceforge.net/
00005 
00006     This file is part of toxic.
00007 
00008     toxic is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     toxic is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with toxic; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00023 #ifndef TOXIC_RENDERER_BASIS_H
00024 #define TOXIC_RENDERER_BASIS_H
00025 
00026 #include "common/math/matrix4.h"
00027 #include "common/math/point3.h"
00028 #include "common/math/vector3.h"
00029 #include "globals.h"
00030 #include "ray.h"
00031 
00032 namespace toxic {
00033 
00034     class Basis {
00035     public:
00036         //! m is the local space to world space transformation matrix.
00037         Basis(const sheep::Matrix4 &m);
00038 
00039         //! Vector v is expressed in local space, returned vector is expressed in world space.
00040         sheep::Vector3 TransformToWorld(const sheep::Vector3 &v) const;
00041 
00042         //! Point p is expressed in local space, returned point is expressed in world space.
00043         sheep::Point3 TransformToWorld(const sheep::Point3 &v) const;
00044 
00045         //! Vector v is expressed in world space, returned vector is expressed in local space.
00046         sheep::Vector3 TransformToLocal(const sheep::Vector3 &v) const;
00047 
00048         //! Point p is expressed in world space, returned point is expressed in local space.
00049         sheep::Point3 TransformToLocal(const sheep::Point3 &v) const;
00050 
00051         //! Ray r is expressed in local space, returned ray is expressed in world space.
00052         //! Direction vector of the returned ray MAY NOT be unit-length.
00053         Ray TransformToWorld(const Ray &r) const;
00054 
00055         //! Ray r is expressed in world space, returned ray is expressed in local space.
00056         //! Direction vector of the returned ray MAY NOT be unit-length.
00057         Ray TransformToLocal(const Ray &r) const;
00058 
00059         //! Normal n is expressed in local space, returned normal is expressed in world space.
00060         //! The returned vector IS unit-length.
00061         sheep::Vector3 TransformNormalToWorld(const sheep::Vector3 &n) const;
00062 
00063         //! Normal n is expressed in world space, returned normal is expressed in local space.
00064         //! The returned vector IS unit-length.
00065         sheep::Vector3 TransformNormalToLocal(const sheep::Vector3 &n) const;
00066 
00067     protected:  //!< Objects may want to directly access to the matrices.
00068         sheep::Matrix4 m_m;         //!< Local space to world space vector transformation matrix.
00069         sheep::Matrix4 m_inv_m;     //!< World space to local space vector transformation matrix.
00070         sheep::Matrix4 m_tr_inv_m;  //!< Local space to world space normal transformation matrix.
00071         sheep::Matrix4 m_tr_m;      //!< World space to local space normal transformation matrix.
00072     };
00073 
00074 #include "basis.inl"
00075 
00076 }
00077 
00078 #endif  // !TOXIC_RENDERER_BASIS_H

Generated on Tue May 11 01:31:49 2004 for toxic by doxygen 1.3.6