Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JCompass.cc File Reference

Example compass operations. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JGeometry3D/JPosition3D.hh"
#include "JDetector/JCompass.hh"
#include "JDetector/JCompassMatrix.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example compass operations.

Author
mdejong

Definition in file JCompass.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 21 of file JCompass.cc.

22 {
23  using namespace std;
24  using namespace JPP;
25 
26  JCompass compass;
27  int debug;
28 
29  try {
30 
31  JParser<> zap;
32 
33  zap['C'] = make_field(compass) = JCompass();
34  zap['d'] = make_field(debug) = 3;
35 
36  zap(argc, argv);
37  }
38  catch(const exception &error) {
39  FATAL(error.what() << endl);
40  }
41 
42 
43 
44  const JCompassMatrix R(compass);
45 
46  cout << "compass " << compass << endl;
47  cout << R << endl;
48 
49  JPosition3D pos[] = {
50  JPosition3D(1, 0, 0),
51  JPosition3D(0, 1, 0),
52  JPosition3D(0, 0, 1)
53  };
54 
55  for (int i = 0; i != sizeof(pos)/sizeof(pos[0]); ++i) {
56 
57  cout << showpos << FIXED(8,3) << pos[i] << " -> ";
58 
59  pos[i].rotate(R);
60 
61  cout << showpos << FIXED(8,3) << pos[i] << endl;
62  }
63 }
Utility class to parse command line options.
Definition: JParser.hh:1493
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:481
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
int debug
debug level
Definition: JSirene.cc:61
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
#define FATAL(A)
Definition: JMessage.hh:67