MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
rotrel.cc File Reference
#include "mbconfig.h"
#include <cstring>
#include <iostream>
#include "matvec3.h"
Include dependency graph for rotrel.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 rotrel.cc.

References dRaDegr, EulerAngles2MatR(), MatR2EulerAngles(), R, and Mat3x3::Transpose().

41 {
42  flag f(0);
43 
44  if (argn > 1) {
45  if (!strcasecmp(argv[1], "-?")
46  || !strcasecmp(argv[1], "-h")
47  || !strcasecmp(argv[1], "--help")) {
48  std::cerr << std::endl
49  << "usage: " << argv[0]
50  << " [mat|euler]" << std::endl
51  << std::endl
52  << " reads the Euler angles (in degs)"
53  " of bodies 1 and 2 from stdin;" << std::endl
54  << " writes, on standard output:" << std::endl
55  << " default|\"euler\", the relative"
56  " Euler angles," << std::endl
57  << " \"mat\", the relative rotation"
58  " matrix (column-oriented)" << std::endl
59  << std::endl
60  << "part of MBDyn package (Copyright (C)"
61  " Pierangelo Masarati, 1996-2004)" << std::endl
62  << std::endl;
63  exit(EXIT_SUCCESS);
64  } else if (!strcasecmp(argv[1], "mat")) {
65  f = flag(1);
66  } else if (!strcasecmp(argv[1], "euler")) {
67  f = flag(0);
68  } else {
69  f = flag(0);
70  }
71  }
72 
73  static doublereal d[3];
74  while (true) {
75  std::cin >> d[0];
76  if (std::cin) {
77  std::cin >> d[1] >> d[2];
79  std::cin >> d[0] >> d[1] >> d[2];
81  Mat3x3 R(R1.Transpose()*R2);
82 
83  if (f) {
84  std::cout << R << std::endl;
85  } else {
86  std::cout << MatR2EulerAngles(R)*dRaDegr << std::endl;
87  }
88  } else {
89  break;
90  }
91  }
92 
93  return (EXIT_SUCCESS);
94 }
long int flag
Definition: mbdyn.h:43
Definition: matvec3.h:98
const doublereal dRaDegr
Definition: matvec3.cc:884
Vec3 MatR2EulerAngles(const Mat3x3 &R)
Definition: matvec3.cc:887
Mat3x3 EulerAngles2MatR(const Vec3 &v)
Definition: matvec3.cc:1008
double doublereal
Definition: colamd.c:52
Mat3x3 R

Here is the call graph for this function: