MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
rot2phi.cc File Reference
#include "mbconfig.h"
#include <cstring>
#include <iostream>
#include "matvec3.h"
#include "matvecexp.h"
#include "Rot.hh"
Include dependency graph for rot2phi.cc:

Go to the source code of this file.

Functions

int main (int argn, const char *const argv[])
 

Function Documentation

int main ( int  argn,
const char *const  argv[] 
)

Definition at line 40 of file rot2phi.cc.

References M11, M12, M13, M21, M22, M23, M31, M32, M33, M_PI, Vec3::Norm(), and RotManip::VecRot().

41 {
42  if (argn > 1) {
43  if (!strcasecmp(argv[1], "-?")
44  || !strcasecmp(argv[1], "-h")
45  || !strcasecmp(argv[1], "--help")) {
46  std::cerr << std::endl << "usage: " << argv[0] << std::endl << std::endl
47  << " reads a rotation matrix (row-oriented) from stdin;" << std::endl
48  << " writes the rotation vector {magniture (in degs), direction} on standard output" << std::endl << std::endl
49  << "part of MBDyn package (Copyright (C) Pierangelo Masarati, 1996)" << std::endl << std::endl;
50  exit(EXIT_SUCCESS);
51  }
52  }
53 
54  std::cout.precision(16);
55 
56  static doublereal d[9];
57  while (true) {
58  std::cin >> d[M11];
59  if (std::cin) {
60  std::cin >> d[M12] >> d[M13]
61  >> d[M21] >> d[M22] >> d[M23] >> d[M31] >> d[M32] >> d[M33];
62  Vec3 phi(RotManip::VecRot(Mat3x3(d, 3)));
63  doublereal d = phi.Norm();
64  if (d != 0.) {
65  std::cout << d*180./M_PI << " " << phi/d << std::endl;
66  } else {
67  std::cout << 0. << " " << 0. << " " << 0. << " " << 0. << std::endl;
68  }
69  } else {
70  break;
71  }
72  }
73 
74  return (EXIT_SUCCESS);
75 }
#define M_PI
Definition: gradienttest.cc:67
Definition: matvec3.h:98
Definition: matvec3.h:59
Definition: matvec3.h:58
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Definition: matvec3.h:55
Definition: matvec3.h:56
Definition: matvec3.h:63
Definition: matvec3.h:62
Definition: matvec3.h:61
Definition: matvec3.h:57
Definition: matvec3.h:60
double doublereal
Definition: colamd.c:52

Here is the call graph for this function: