00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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 }}}}
00274
00275 #endif