testAxialVector.cc
Go to the documentation of this file.
1 
10 #include <utl/CoordinateSystem.h>
11 #include <utl/AxialVector.h>
12 #include <utl/Vector.h>
13 #include <utl/TransformationMatrix.h>
14 #include <utl/AugerUnits.h>
15 #include <tst/Verify.h>
16 #include <utl/Triple.h>
17 
18 #include <cppunit/extensions/HelperMacros.h>
19 
20 using namespace utl;
21 using namespace tst;
22 
23 
27 class testAxialVector : public CppUnit::TestFixture {
28 
29  CPPUNIT_TEST_SUITE(testAxialVector);
30  CPPUNIT_TEST(testAxialVectorTransformation);
31  CPPUNIT_TEST_SUITE_END();
32 
33 public:
34  void setUp() { }
35 
36  void tearDown() { }
37 
38  void
40  {
41  const CoordinateSystemPtr CS(CoordinateSystem::GetRootCoordinateSystem());
42  const AxialVector p(0,0,0, CS);
43 
44  const Vector t(1,0,0, CS);
46 
47  p.TransformTo(CTrans);
48  CPPUNIT_ASSERT(p.GetCoordinateSystem() == CTrans);
49  CPPUNIT_ASSERT(Verify<CloseTo>(
50  p.GetCoordinates(CTrans), Triple(0,0,0)));
51  CPPUNIT_ASSERT(p.GetCoordinateSystem() == CTrans);
52  CPPUNIT_ASSERT(Verify<CloseTo>(
53  p.GetCoordinates(CS), Triple(0,0,0)));
54  CPPUNIT_ASSERT(p.GetCoordinateSystem() == CS);
55 
56  const AxialVector horizontal(1,0,0, CS);
58  horizontal.TransformTo(CRot);
59  CPPUNIT_ASSERT(horizontal.GetCoordinateSystem() == CRot);
60  CPPUNIT_ASSERT(Verify<CloseTo>(
61  horizontal.GetCoordinates(CRot), Triple(0,-1,0)));
62  CPPUNIT_ASSERT(horizontal.GetCoordinateSystem() == CRot);
63  CPPUNIT_ASSERT(Verify<CloseTo>(
64  horizontal.GetCoordinates(CS), Triple(1,0,0)));
65  CPPUNIT_ASSERT(horizontal.GetCoordinateSystem() == CS);
66  }
67 
68 };
69 
70 
72 
73 
74 // Configure (x)emacs for this file ...
75 // Local Variables:
76 // mode:c++
77 // compile-command: "make -C .. -k run-testGeometry"
78 // End:
CoordinateSystemPtr GetCoordinateSystem() const
Get the coordinate system of the current internal representation.
Definition: BasicVector.h:234
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
constexpr double deg
Definition: AugerUnits.h:140
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
boost::tuple< double, double, double > Triple
Coordinate triple for easy getting or setting of coordinates.
Definition: Triple.h:15
static Policy::type RotationZ(const double angle, const CoordinateSystemPtr &theCS)
Construct from rotation about Z axis.
static Policy::type Translation(const Vector &theTranslation, const CoordinateSystemPtr &theCS)
Construct from translation by vector.
Vector object.
Definition: Vector.h:30
AxialVector object.
Definition: AxialVector.h:30
void testAxialVectorTransformation()

, generated on Tue Sep 26 2023.