OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unittests_vector_type.hh
1 #ifndef INCLUDE_UNITTESTS_OpenMeshVectorTest_HH
2 #define INCLUDE_UNITTESTS_OpenMeshVectorTest_HH
3 
4 #include <gtest/gtest.h>
5 #include <Unittests/unittests_common.hh>
6 #include <iostream>
7 
8 class OpenMeshVectorTest : public testing::Test {
9 
10  protected:
11 
12  // This function is called before each test is run
13  virtual void SetUp() {
14 
15  // Do some initial stuff with the member data here...
16  }
17 
18  // This function is called after all tests are through
19  virtual void TearDown() {
20 
21  // Do some final stuff with the member data here...
22  }
23 
24 };
25 
26 
27 
28 /*
29  * ====================================================================
30  * Define tests below
31  * ====================================================================
32  */
33 
34 /* Compute surface area via cross product
35  */
36 TEST_F(OpenMeshVectorTest, ComputeTriangleSurfaceWithCrossProduct) {
37 
38 
39  //
40  // vec1
41  // x
42  // |
43  // |
44  // |
45  // x------>x vec2
46  //
47 
48  OpenMesh::Vec3d vec1(0.0,1.0,0.0);
49  OpenMesh::Vec3d vec2(1.0,0.0,0.0);
50 
51  double area = 0.5 * cross(vec1,vec2).norm();
52  EXPECT_EQ(0.5f , area ) << "Wrong area in cross product function";
53 
54  area = 0.5 * ( vec1 % vec2 ).norm();
55  EXPECT_EQ(0.5f , area ) << "Wrong area in cross product operator";
56 
57 }
58 
59 /* Check OpenMesh Vector type abs function
60  */
61 TEST_F(OpenMeshVectorTest, AbsTest) {
62 
63  OpenMesh::Vec3d vec1(0.5,0.5,-0.5);
64 
65  EXPECT_EQ( vec1.l8_norm() , 0.5f ) << "Wrong l8norm computation";
66 
67 }
68 
69 
70 
71 
72 #endif // INCLUDE GUARD

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .