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_dim3_impl_Transform_hxx
00034 #define esve_engine_dim3_impl_Transform_hxx
00035
00036 #include <esve/engine/dim3/Transform.hxx>
00037 #include <esve/base/dim3/Transform.hxx>
00038 #include <esve/types/quat.hxx>
00039 #include <esve/types/pure.hxx>
00040
00041 namespace esve { namespace engine { namespace dim3 { namespace impl {
00042
00047
00048 class Transform
00049 : virtual public dim3::Transform
00050 {
00051 private:
00052 typedef
00053 base::dim3::Transform<types::real>
00054 m_Transform ;
00055
00056 m_Transform m ;
00057
00058 public:
00060 Transform()
00061 : dim3::Transform(),
00062 m() { }
00063
00065 Transform( const types::quat & rotation,
00066 const types::pure & translation = types::pure(),
00067 types::real scaling = types::real(1) )
00068 : dim3::Transform(),
00069 m(rotation,
00070 translation,
00071 scaling) { }
00072
00073 Transform( const Transform & a )
00074 : dim3::Transform(),
00075 m(a.m) { }
00076
00077 Transform( const dim3::Transform & a )
00078 : dim3::Transform(),
00079 m(a.rotation(),
00080 a.translation(),
00081 a.scaling()) { }
00082
00083 Transform & operator=( const Transform & a )
00084 {
00085 m = a.m ;
00086 return *this ;
00087 }
00088
00089 Transform & operator=( const dim3::Transform & a )
00090 {
00091 m.rotation(a.rotation()) ;
00092 m.translation(a.translation()) ;
00093 m.scaling(a.scaling()) ;
00094 return *this ;
00095 }
00096
00097 const types::quat & rotation() const
00098 {
00099 return m.rotation() ;
00100 }
00101
00102 void rotation( const types::quat & a )
00103 {
00104 m.rotation(a) ;
00105 }
00106
00107 const types::pure & translation() const
00108 {
00109 return m.translation() ;
00110 }
00111
00112 void translation( const types::pure & a )
00113 {
00114 m.translation(a) ;
00115 }
00116
00117 types::real scaling() const
00118 {
00119 return m.scaling() ;
00120 }
00121
00122 void scaling( types::real a )
00123 {
00124 m.scaling(a) ;
00125 }
00126
00127 void left_act( const Transform & a )
00128 {
00129 m.left_act(a.m) ;
00130 }
00131
00132 void left_act( const dim3::Transform & a )
00133 {
00134 m.left_act(m_Transform(a.rotation(),
00135 a.translation(),
00136 a.scaling())) ;
00137 }
00138
00139 void right_act( const Transform & a )
00140 {
00141 m.right_act(a.m) ;
00142 }
00143
00144 void right_act( const dim3::Transform & a )
00145 {
00146 m.right_act(m_Transform(a.rotation(),
00147 a.translation(),
00148 a.scaling())) ;
00149 }
00150
00151 void act( const Transform & action,
00152 const Transform & basis )
00153 {
00154 m.act(action.m, basis.m) ;
00155 }
00156
00157 void act( const dim3::Transform & action,
00158 const dim3::Transform & basis )
00159 {
00160 m.act(m_Transform(action.rotation(),
00161 action.translation(),
00162 action.scaling()),
00163 m_Transform(basis.rotation(),
00164 basis.translation(),
00165 basis.scaling())) ;
00166 }
00167
00168 void rotate( types::real angle,
00169 const types::pure & axis,
00170 const dim3::Transform & basis = IDENTITY ) ;
00171
00172 void translate( const types::pure & dt,
00173 const dim3::Transform & basis = IDENTITY ) ;
00174
00175 void scalate( types::real ds,
00176 const dim3::Transform & basis = IDENTITY ) ;
00177
00178 void assign( const Transform & a )
00179 {
00180 m = a.m ;
00181 }
00182
00183 void assign( const dim3::Transform & a )
00184 {
00185 rotation(a.rotation()) ;
00186 translation(a.translation()) ;
00187 scaling(a.scaling()) ;
00188 }
00189
00190 void identity()
00191 {
00192 m.identity() ;
00193 }
00194
00195 void invert()
00196 {
00197 m.invert() ;
00198 }
00199
00200 void normalize()
00201 {
00202 m.normalize() ;
00203 }
00204
00205 bool operator==( const Transform & a ) const
00206 {
00207 return m.operator==(a.m) ;
00208 }
00209
00210 bool operator==( const dim3::Transform & a ) const
00211 {
00212 return m.operator==(m_Transform(a.rotation(),
00213 a.translation(),
00214 a.scaling())) ;
00215 }
00216
00217 bool operator!=( const Transform & a ) const
00218 {
00219 return m.operator!=(a.m) ;
00220 }
00221
00222 bool operator!=( const dim3::Transform & a ) const
00223 {
00224 return m.operator!=(m_Transform(a.rotation(),
00225 a.translation(),
00226 a.scaling())) ;
00227 }
00228
00229 ~Transform() { }
00230 } ;
00231
00232 }}}}
00233
00234 #endif
00235