| 152 | |
| 153 | template< typename T, typename U > |
| 154 | void multiply( U * data, const T &matrix ) |
| 155 | { |
| 156 | assert( data ); |
| 157 | |
| 158 | GeometricData::Interpretation mode = data->getInterpretation(); |
| 159 | typename U::ValueType::iterator beginIt = data->writable().begin(); |
| 160 | typename U::ValueType::iterator endIt = data->writable().end(); |
| 161 | if ( mode == GeometricData::Point ) |
| 162 | { |
| 163 | for ( typename U::ValueType::iterator it = beginIt; it != endIt; it++ ) |
| 164 | { |
| 165 | *it *= matrix; |
| 166 | } |
| 167 | } |
| 168 | else if ( mode == GeometricData::Vector ) |
| 169 | { |
| 170 | for ( typename U::ValueType::iterator it = beginIt; it != endIt; it++ ) |
| 171 | { |
| 172 | matrix.multDirMatrix( *it, *it ); |
| 173 | } |
| 174 | } |
| 175 | else if ( mode == GeometricData::Normal ) |
| 176 | { |
| 177 | T m = matrix.inverse(); |
| 178 | m.transpose(); |
| 179 | for ( typename U::ValueType::iterator it = beginIt; it != endIt; it++ ) |
| 180 | { |
| 181 | m.multDirMatrix( *it, *it ); |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | template<typename U> |
| 187 | void operator() ( U * data ) |