| 1220 | */ |
| 1221 | template<typename Scalar, int Dim, int Mode, int Options> |
| 1222 | EIGEN_DEVICE_FUNC Transform<Scalar,Dim,Mode,Options> |
| 1223 | Transform<Scalar,Dim,Mode,Options>::inverse(TransformTraits hint) const |
| 1224 | { |
| 1225 | Transform res; |
| 1226 | if (hint == Projective) |
| 1227 | { |
| 1228 | internal::projective_transform_inverse<Transform>::run(*this, res); |
| 1229 | } |
| 1230 | else |
| 1231 | { |
| 1232 | if (hint == Isometry) |
| 1233 | { |
| 1234 | res.matrix().template topLeftCorner<Dim,Dim>() = linear().transpose(); |
| 1235 | } |
| 1236 | else if(hint&Affine) |
| 1237 | { |
| 1238 | res.matrix().template topLeftCorner<Dim,Dim>() = linear().inverse(); |
| 1239 | } |
| 1240 | else |
| 1241 | { |
| 1242 | eigen_assert(false && "Invalid transform traits in Transform::Inverse"); |
| 1243 | } |
| 1244 | // translation and remaining parts |
| 1245 | res.matrix().template topRightCorner<Dim,1>() |
| 1246 | = - res.matrix().template topLeftCorner<Dim,Dim>() * translation(); |
| 1247 | res.makeAffine(); // we do need this, because in the beginning res is uninitialized |
| 1248 | } |
| 1249 | return res; |
| 1250 | } |
| 1251 | |
| 1252 | namespace internal { |
| 1253 |
no test coverage detected