aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/math/LinearTransformations.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'meowpp/math/LinearTransformations.hpp')
-rw-r--r--meowpp/math/LinearTransformations.hpp148
1 files changed, 0 insertions, 148 deletions
diff --git a/meowpp/math/LinearTransformations.hpp b/meowpp/math/LinearTransformations.hpp
deleted file mode 100644
index fcb5b8a..0000000
--- a/meowpp/math/LinearTransformations.hpp
+++ /dev/null
@@ -1,148 +0,0 @@
-#include "LinearTransformations.h"
-
-
-#include "utility.h"
-
-#include <cstdlib>
-#include <cmath>
-
-namespace meow{
- template<class Scalar>
- inline void
- Rotation3D<Scalar>::calcMatrix(){
- Scalar sum(0.0);
- for(size_t i = 0; i < 3u; i++){
- sum = sum + squ(_theta(i, 0));
- }
- Scalar t(sqrt(double(sum)));
- std::vector<Scalar> u(3);
- for(size_t i = 0; i < 3u; i++){
- u[i] = _theta[i] / t;
- }
- Scalar cs(cos(double(t)));
- Scalar sn(sin(double(t)));
-
- _matrix.entry(0, 0, cs + squ(u[0]) * ((1 - cs)));
- _matrix.entry(1, 1, cs + squ(u[1]) * ((1 - cs)));
- _matrix.entry(2, 2, cs + squ(u[2]) * ((1 - cs)));
- _matrix.entry(0, 1, u[0] * u[1] * (1 - cs) - u[2] * sn);
- _matrix.entry(1, 0, u[1] * u[0] * (1 - cs) + u[2] * sn);
- _matrix.entry(0, 2, u[0] * u[2] * (1 - cs) + u[1] * sn);
- _matrix.entry(2, 0, u[2] * u[0] * (1 - cs) - u[1] * sn);
- _matrix.entry(1, 2, u[1] * u[2] * (1 - cs) - u[0] * sn);
- _matrix.entry(2, 1, u[2] * u[1] * (1 - cs) + u[0] * sn);
- }
-
-
- template<class Scalar>
- inline
- Rotation3D<Scalar>::Rotation3D():
- LinearTransformation(3u, 3u, 3u){
- _theta[0] = _theta[1] = _theta[2] = Scalar(0);
- _matrix.identitied();
- }
-
-
- template<class Scalar>
- inline void
- Rotation3D<Scalar>::axisTheta(Matrix<Scalar> const& __axis,
- Scalar const& __theta){
- Scalar sum(0.0);
- for(size_t i = 0; i < 3u; i++)
- sum = sum + squ(__axis(i, 0));
- Scalar t(sqrt(double(sum)));
- for(size_t i = 0; i < 3u; i++)
- _theta[i] = __axis(i, 0) * __theta / t;
- calcMatrix();
- }
-
-
- template<class Scalar>
- inline Scalar
- Rotation3D<Scalar>::parameter(size_t __i) const{
- return _theta[__i];
- }
-
-
- template<class Scalar>
- inline Scalar
- Rotation3D<Scalar>::parameter(size_t __i, Scalar const& __s) const{
- _theta[__i] = __s;
- calcMatrix();
- return _theta[__i];
- }
-
-
- template<class Scalar>
- inline Matrix<Scalar>
- Rotation3D<Scalar>::transformate(Matrix<Scalar> const& __x) const{
- return _matrix * __x;
- }
-
-
- template<class Scalar>
- inline Matrix<Scalar>
- Rotation3D<Scalar>::jacobian(Matrix<Scalar> const& __x) const{
- return _matrix;
- }
-
-
- template<class Scalar>
- inline Matrix<Scalar>
- Rotation3D<Scalar>::jacobian(Matrix<Scalar> const& __x,
- size_t __i) const{
- Matrix<Scalar> mid(3u, 3u, Scalar(0.0));
- if(__i == 0){
- mid.entry(1, 2, Scalar(-1.0));
- mid.entry(2, 1, Scalar( 1.0));
- }else if(__i == 1){
- mid.entry(0, 2, Scalar( 1.0));
- mid.entry(2, 0, Scalar(-1.0));
- }else{
- mid.entry(0, 1, Scalar(-1.0));
- mid.entry(1, 0, Scalar( 1.0));
- }
- return _matrix * mid * __x;
- }
-
-
- template<class Scalar>
- inline Matrix<Scalar>
- Rotation3D<Scalar>::invTransformate(Matrix<Scalar> const& __x) const{
- return _matrix.transpose() * __x;
- }
-
-
- template<class Scalar>
- inline Matrix<Scalar>
- Rotation3D<Scalar>::invJacobian(Matrix<Scalar> const& __x) const{
- return _matrix.transpose();
- }
-
-
- template<class Scalar>
- inline Matrix<Scalar>
- Rotation3D<Scalar>::invJacobian(Matrix<Scalar> const& __x,
- size_t __i) const{
- Matrix<Scalar> mid(3u, 3u, Scalar(0.0));
- if(__i == 0){
- mid.entry(1, 2, Scalar(-1.0));
- mid.entry(2, 1, Scalar( 1.0));
- }else if(__i == 1){
- mid.entry(0, 2, Scalar( 1.0));
- mid.entry(2, 0, Scalar(-1.0));
- }else{
- mid.entry(0, 1, Scalar(-1.0));
- mid.entry(1, 0, Scalar( 1.0));
- }
- return _matrix.transpose() * mid.transpose() * __x;
- }
-
-
- template<class Scalar>
- inline Matrix<Scalar>
- Rotation3D<Scalar>::invMatrix() const{
- return _matrix.transpose();
- }
-}
-