Commit 471e6200 authored by Jan Möbius's avatar Jan Möbius
Browse files

Added unittest for vector cross product



git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@754 fdac6126-5c0c-442c-9429-916003d36597
parent 1188a4c2
......@@ -17,6 +17,7 @@
#include "unittests_trimesh_garbage_collection.hh"
#include "unittests_randomNumberGenerator.hh"
#include "unittests_split_copy.hh"
#include "unittests_vector_type.hh"
int main(int _argc, char** _argv) {
......
#ifndef INCLUDE_UNITTESTS_OpenMeshVectorTest_HH
#define INCLUDE_UNITTESTS_OpenMeshVectorTest_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
class OpenMeshVectorTest : public testing::Test {
protected:
// This function is called before each test is run
virtual void SetUp() {
// Do some initial stuff with the member data here...
}
// This function is called after all tests are through
virtual void TearDown() {
// Do some final stuff with the member data here...
}
};
/*
* ====================================================================
* Define tests below
* ====================================================================
*/
/* Compute surface area via cross product
*/
TEST_F(OpenMeshVectorTest, ComputeTriangleSurfaceWithCrossProduct) {
//
// vec1
// x
// |
// |
// |
// x------>x vec2
//
OpenMesh::Vec3d vec1(0.0,1.0,0.0);
OpenMesh::Vec3d vec2(1.0,0.0,0.0);
double area = 0.5 * cross(vec1,vec2).norm();
EXPECT_EQ(0.5f , area ) << "Wrong area in cross product function";
area = 0.5 * ( vec1 % vec2 ).norm();
EXPECT_EQ(0.5f , area ) << "Wrong area in cross product operator";
}
#endif // INCLUDE GUARD
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment