Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

Transform.hxx

00001 
00002 // 
00003 // Copyright (C) 2006 James M. Lawrence.  All rights reserved.
00004 // 
00005 // software: esve-1.0.3
00006 // file: esve/engine/dim4/impl/Transform.hxx
00007 // 
00008 // Redistribution and use in source and binary forms, with or without
00009 // modification, are permitted provided that the following conditions
00010 // are met:
00011 // 
00012 // 1. Redistributions of source code must retain the above copyright
00013 //    notice, this list of conditions and the following disclaimer.
00014 // 
00015 // 2. The origin of this software must not be misrepresented; you must
00016 //    not claim that you wrote the original software.  If you use this
00017 //    software in a product, an acknowledgment in the product 
00018 //    documentation would be appreciated but is not required.
00019 // 
00020 // 3. Altered source versions must be plainly marked as such, and must
00021 //    not be misrepresented as being the original software.
00022 // 
00023 // 4. The name of the author may not be used to endorse or promote
00024 //    products derived from this software without specific prior written
00025 //    permission.
00026 // 
00027 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY,
00028 // AND WITH NO CLAIM AS TO ITS SUITABILITY FOR ANY PURPOSE.  IN NO EVENT
00029 // SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM WHATSOEVER MADE IN CONNECTION
00030 // TO THIS SOFTWARE.
00031 // 
00033 #ifndef esve_engine_dim4_impl_Transform_hxx
00034 #define esve_engine_dim4_impl_Transform_hxx
00035 
00036 #include <esve/engine/dim4/Transform.hxx>
00037 #include <esve/base/dim4/Transform.hxx>
00038 #include <esve/types/quat.hxx>
00039 #include <esve/types/pure.hxx>
00040 
00041 namespace esve { namespace engine { namespace dim4 { namespace impl {
00042 
00047 
00048 class Transform
00049     : virtual public dim4::Transform
00050 {
00051 private:
00052     typedef base::dim4::Transform<types::real> m_Transform ;
00053 
00054     m_Transform m ;
00055 
00056 public:
00059     Transform()
00060         : engine::dim4::Transform(),
00061           m() { }
00062 
00063 
00066     Transform( const types::quat & a,
00067                const types::quat & b,
00068                const types::quat & c,
00069                const types::quat & d )
00070         : engine::dim4::Transform(),
00071           m(a,
00072             b,
00073             c,
00074             d) { }
00076 
00077     Transform( const Transform & h )
00078         : engine::dim4::Transform(),
00079           m(h.m) { }
00080 
00081     Transform( const engine::dim4::Transform & h )
00082         : engine::dim4::Transform(),
00083           m(h.a(),
00084             h.b(),
00085             h.c(),
00086             h.d()) { }
00087 
00088     Transform & operator=( const Transform & h )
00089     {
00090         m = h.m ;
00091         return *this ;
00092     }
00093 
00094     Transform & operator=( const engine::dim4::Transform & h )
00095     {
00096         m.a(h.a()) ;
00097         m.b(h.b()) ;
00098         m.c(h.c()) ;
00099         m.d(h.d()) ;
00100         return *this ;
00101     }
00102 
00104     const types::quat & a() const
00105     {
00106         return m.a() ;
00107     }
00108 
00109     void a( const types::quat & a )
00110     {
00111         m.a(a) ;
00112     }
00114 
00116     const types::quat & b() const
00117     {
00118         return m.b() ;
00119     }
00120 
00121     void b( const types::quat & b )
00122     {
00123         m.b(b) ;
00124     }
00126 
00128     const types::quat & c() const
00129     {
00130         return m.c() ;
00131     }
00132 
00133     void c( const types::quat & c )
00134     {
00135         m.c(c) ;
00136     }
00138 
00140     const types::quat & d() const
00141     {
00142         return m.d() ;
00143     }
00144 
00145     void d( const types::quat & d )
00146     {
00147         m.d(d) ;
00148     }
00150 
00151     void left_act( const Transform & left )
00152     {
00153         m.left_act(left.m) ;
00154     }
00155 
00156     void left_act( const engine::dim4::Transform & left )
00157     {
00158         m.left_act(m_Transform(left.a(),
00159                                left.b(),
00160                                left.c(),
00161                                left.d())) ;
00162     }
00163 
00164     void right_act( const Transform & right )
00165     {
00166         m.right_act(right.m) ;
00167     }
00168 
00169     void right_act( const engine::dim4::Transform & right )
00170     {
00171         m.right_act(m_Transform(right.a(),
00172                                 right.b(),
00173                                 right.c(),
00174                                 right.d())) ;
00175     }
00176 
00177     void act( const Transform & action,
00178               const Transform & basis )
00179     {
00180         m.act(action.m, basis.m) ;
00181     }
00182 
00183     void act( const engine::dim4::Transform & action,
00184               const engine::dim4::Transform & basis )
00185     {
00186         m.act(m_Transform(action.a(),
00187                           action.b(),
00188                           action.c(),
00189                           action.d()),
00190               m_Transform(basis.a(),
00191                           basis.b(),
00192                           basis.c(),
00193                           basis.d())) ;
00194     }
00195 
00196     void rotate( types::real alpha,
00197                  types::real beta,
00198                  const types::quat & r,
00199                  const types::quat & s,
00200                  const engine::dim4::Transform & basis = IDENTITY ) ;
00201 
00202     void rotate( types::real alpha,
00203                  types::real beta,
00204                  const types::pure & u,
00205                  const engine::dim4::Transform & basis = IDENTITY ) ;
00206 
00207     void translate( const types::quat & r,
00208                     const engine::dim4::Transform & basis = IDENTITY ) ;
00209 
00210     void invertate( const types::quat & r,
00211                     const engine::dim4::Transform & basis = IDENTITY ) ;
00212 
00213     void scalate( types::real gamma,
00214                   const engine::dim4::Transform & basis = IDENTITY ) ;
00215 
00216     void identity()
00217     {
00218         m.identity() ;
00219     }
00220 
00221     void invert()
00222     {
00223         m.invert() ;
00224     }
00225 
00226     void assign( const Transform & h )
00227     {
00228         m = h.m ;
00229     }
00230 
00231     void assign( const engine::dim4::Transform & h )
00232     {
00233         m = m_Transform(h.a(),
00234                         h.b(),
00235                         h.c(),
00236                         h.d()) ;
00237     }
00238 
00239     void normalize()
00240     {
00241         m.normalize() ;
00242     }
00243 
00244     bool operator==( const Transform & h ) const
00245     {
00246         return m.operator==(h.m) ;
00247     }
00248 
00249     bool operator==( const engine::dim4::Transform & h ) const
00250     {
00251         return m.operator==(m_Transform(h.a(),
00252                                         h.b(),
00253                                         h.c(),
00254                                         h.d())) ;
00255     }
00256 
00257     bool operator!=( const Transform & h ) const
00258     {
00259         return m.operator!=(h.m) ;
00260     }
00261 
00262     bool operator!=( const engine::dim4::Transform & h ) const
00263     {
00264         return m.operator!=(m_Transform(h.a(),
00265                                         h.b(),
00266                                         h.c(),
00267                                         h.d())) ;
00268     }
00269 
00270     ~Transform() { }
00271 } ;
00272 
00273 }}}} // namespace esve::engine::dim4::impl
00274 
00275 #endif

Generated on Tue May 30 11:40:53 2006 for esve by doxygen 1.3.4