testOperationsPV.cc
Go to the documentation of this file.
1 
10 #include <utl/Point.h>
11 #include <utl/Vector.h>
12 
13 #include <tst/Verify.h>
14 #include <utl/Triple.h>
15 
16 #include <cppunit/extensions/HelperMacros.h>
17 
18 using namespace utl;
19 using namespace tst;
20 
21 
25 class testOperationsPV : public CppUnit::TestFixture {
26 
27  CPPUNIT_TEST_SUITE(testOperationsPV);
28  CPPUNIT_TEST(testOperationsPointVector);
29  CPPUNIT_TEST_SUITE_END();
30 
31 public:
32  void setUp() { }
33 
34  void tearDown() { }
35 
36  void
38  {
39  const CoordinateSystemPtr CS(CoordinateSystem::GetRootCoordinateSystem());
40  const Vector v1(1,0,0, CS);
41  const Point o(0,0,0, CS);
42 
43  const Point p1(o + v1);
44  CPPUNIT_ASSERT(Verify<CloseTo>(
45  p1.GetCoordinates(CS), Triple(1,0,0)));
46  const Point p2(v1 + o);
47  CPPUNIT_ASSERT(Verify<CloseTo>(
48  p2.GetCoordinates(CS), Triple(1,0,0)));
49 
50  const Point p3(o - v1);
51  CPPUNIT_ASSERT(Verify<CloseTo>(
52  p3.GetCoordinates(CS), Triple(-1,0,0)));
53 
54  const Point p4(1,4,2, CS);
55  const Point p5(1,3,1, CS);
56  const Vector v2(p4 - p5);
57  CPPUNIT_ASSERT(Verify<CloseTo>(
58  v2.GetCoordinates(CS), Triple(0,1,1)));
59 
60  Point p6(1,1,1, CS);
61  const Vector v3(1,1,1, CS);
62  p6 -= v3;
63  CPPUNIT_ASSERT(Verify<CloseTo>(p6.GetCoordinates(CS), Triple(0,0,0)));
64  p6 += v3;
65  CPPUNIT_ASSERT(Verify<CloseTo>(p6.GetCoordinates(CS), Triple(1,1,1)));
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:
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
Vector object.
Definition: Vector.h:30
void testOperationsPointVector()

, generated on Tue Sep 26 2023.