MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
rot2eup.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/utils/rot2eup.cc,v 1.25 2017/01/12 15:10:28 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  *
10  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
11  * via La Masa, 34 - 20156 Milano, Italy
12  * http://www.aero.polimi.it
13  *
14  * Changing this copyright notice is forbidden.
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation (version 2 of the License).
19  *
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29  */
30 
31 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
32 
33 #include <cstring>
34 #include <iostream>
35 
36 #include "matvec3.h"
37 
38 
39 int main(int argn, const char* const argv[])
40 {
41  if (argn > 1) {
42  if (!strcasecmp(argv[1], "-?")
43  || !strcasecmp(argv[1], "-h")
44  || !strcasecmp(argv[1], "--help")) {
45  std::cerr << std::endl << "usage: " << argv[0] << std::endl << std::endl
46  << " reads a rotation matrix (row-oriented) from stdin;" << std::endl
47  << " writes the Euler parameters on standard output" << std::endl << std::endl
48  << "part of MBDyn package (Copyright (C) Pierangelo Masarati, 1996)" << std::endl << std::endl;
49  exit(EXIT_SUCCESS);
50  }
51  }
52 
53  static doublereal d[9];
54  while (true) {
55  std::cin >> d[0];
56  if (std::cin) {
57  Vec3 e;
58  doublereal e0;
59  std::cin >> d[3] >> d[6] >> d[1] >> d[4] >> d[7] >> d[2] >> d[5] >> d[8];
60  MatR2EulerParams(Mat3x3(d, 3), e0, e);
61  std::cout << e0 << " " << e << std::endl;
62  } else {
63  break;
64  }
65  }
66 
67  return (EXIT_SUCCESS);
68 }
69 
Definition: matvec3.h:98
int main(int argn, const char *const argv[])
Definition: rot2eup.cc:39
double doublereal
Definition: colamd.c:52
void MatR2EulerParams(const Mat3x3 &R, doublereal &e0, Vec3 &e)
Definition: matvec3.cc:954