testTransformation.cc
Go to the documentation of this file.
1 
10 #include <utl/Transformation.h>
11 #include <utl/TransformationMatrix.h>
12 #include <utl/Point.h>
13 #include <utl/Vector.h>
14 #include <utl/CoordinateSystem.h>
15 
16 #include <cmath>
17 
18 #include <tst/Verify.h>
19 #include <utl/Triple.h>
20 
21 #include <cppunit/extensions/HelperMacros.h>
22 
23 using namespace utl;
24 using namespace tst;
25 
26 
30 class testTransformation : public CppUnit::TestFixture {
31 
32  CPPUNIT_TEST_SUITE(testTransformation);
33  CPPUNIT_TEST(testConstructor);
34  CPPUNIT_TEST(testTransform);
35  CPPUNIT_TEST_SUITE_END();
36 
37 public:
38  void setUp() { }
39 
40  void tearDown() { }
41 
42  void
44  {
45  const CoordinateSystemPtr RCS(CoordinateSystem::GetRootCoordinateSystem());
46 
47  const Transformation t2(Transformation::RotationX(M_PI/3, RCS));
49  const Transformation t3(Transformation::RotationZ(M_PI/3, C2));
50  CPPUNIT_ASSERT(Verify<CloseTo>(t2.Distance(t3), 0.));
51  }
52 
53  void
55  {
56  const CoordinateSystemPtr RCS(CoordinateSystem::GetRootCoordinateSystem());
58  const Transformation tr(Transformation::RotationZ(M_PI/2, RCS));
59  const Vector vx(1,0,0, RCS);
60  const Vector vxr(tr * vx);
61  CPPUNIT_ASSERT(Verify<CloseTo>(
62  vxr.GetCoordinates(RCS), Triple(0,1,0)));
63  const Point px(1,0,0, RCS);
64  const Point pxr(tr * px);
65  CPPUNIT_ASSERT(Verify<CloseTo>(
66  pxr.GetCoordinates(RCS), Triple(0,1,0)));
67 
68  const Vector ex(1,0,0, RCS);
70  const Vector vxt(tt * vx);
71  CPPUNIT_ASSERT(Verify<CloseTo>(
72  vxt.GetCoordinates(RCS), Triple(1,0,0)));
73  const Point pxt(tt * px);
74  CPPUNIT_ASSERT(Verify<CloseTo>(
75  pxt.GetCoordinates(RCS), Triple(2,0,0)));
76  }
77 
78 };
79 
80 
82 
83 
84 // Configure (x)emacs for this file ...
85 // Local Variables:
86 // mode:c++
87 // compile-command: "make -C .. -k run-testGeometry"
88 // End:
Point object.
Definition: Point.h:32
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
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
Active transformations of geometrical objects.
static Policy::type RotationY(const double angle, const CoordinateSystemPtr &theCS)
Construct from rotation about Y axis.
a t3: algo, second, usecond and a vector of &lt;t3stat&gt;
Definition: XbT2.h:29
static Policy::type RotationZ(const double angle, const CoordinateSystemPtr &theCS)
Construct from rotation about Z axis.
a second level trigger
Definition: XbT2.h:8
static Policy::type Translation(const Vector &theTranslation, const CoordinateSystemPtr &theCS)
Construct from translation by vector.
Vector object.
Definition: Vector.h:30
static Policy::type RotationX(const double angle, const CoordinateSystemPtr &theCS)
Construct from rotation about X axis.

, generated on Tue Sep 26 2023.