Merge branch 'CustomProperties' of https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh into CustomProperties

This commit is contained in:
Alexandra Heuschling
2021-02-26 19:19:37 +01:00
33 changed files with 855 additions and 246 deletions

View File

@@ -34,10 +34,6 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
message(WARNING "Eigen3 not found! This will skip the Eigen3 Unittests. You can point cmake to Eigen3 by setting Eigen3_DIR to the cmake files of Eigen3")
endif()
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
add_definitions( /D _VARIADIC_MAX=10 )
endif()
# Create new target named unittests_hexmeshing
FILE(GLOB UNITTEST_SRC *.cc)
# Create unittest executable

Binary file not shown.

View File

@@ -201,8 +201,12 @@ TEST_F(OpenMeshConvertPolyMeshToTriangle, VertexFaceCheck) {
EXPECT_EQ(4u, p.n_vertices() ) << "Wrong number of vertices in TriMesh";
Mesh::VertexIter it = mesh_.vertices_begin();
//add face to original mesh
mesh_.add_face(vhand,(*it),(*++it));
Mesh::VertexHandle vhand1 = *it;
Mesh::VertexHandle vhand2 = (*++it);
mesh_.add_face(vhand,vhand1,vhand2);
EXPECT_EQ(2u, mesh_.n_faces() ) << "Wrong number of faces in PolyMesh";
EXPECT_EQ(2u, p.n_faces() ) << "Wrong number of faces in TriMesh";

View File

@@ -0,0 +1,65 @@
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshDirectSettingProperties : public OpenMeshBase {
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...
}
// Member already defined in OpenMeshBase
//Mesh mesh_;
};
/*
* ====================================================================
* Define tests below
* ====================================================================
*/
/* Adds two triangles to a tri mesh
*/
TEST_F(OpenMeshDirectSettingProperties, SetVertexPositionsDirectly) {
mesh_.clear();
// Add some vertices
Mesh::VertexHandle vhandle[4];
vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 0, 0));
vhandle[1] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
vhandle[2] = mesh_.add_vertex(Mesh::Point(1, 1, 0));
vhandle[3] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
auto pos_pro = mesh_.points_property_handle();
auto point_vector = mesh_.property(pos_pro).data_vector();
int vertex_count = 0;
for( auto p : point_vector) {
// std::cerr << p[0] << " " << p[1] << " " << p[2] << std::endl;
++vertex_count;
}
EXPECT_EQ(4u, mesh_.n_vertices() ) << "Wrong number of vertices";
EXPECT_EQ(4, vertex_count) << "Wrong number of vertices when counting direct point property vector";
}
}

View File

@@ -1027,6 +1027,28 @@ TEST_F(OpenMeshSubdividerUniform_Triangle, Modified_Butterfly) {
TEST_F(OpenMeshSubdividerUniform_Triangle, Modified_Butterfly_cylinder) {
mesh_.clear();
OpenMesh::IO::read_mesh(mesh_, "cylinder.om");
// Initialize subdivider
OpenMesh::Subdivider::Uniform::ModifiedButterflyT<Mesh> butter;
// Check setup
EXPECT_EQ(66u, mesh_.n_vertices() ) << "Wrong number of vertices";
EXPECT_EQ(128u, mesh_.n_faces() ) << "Wrong number of faces";
// Execute 3 subdivision steps
butter( mesh_,3,true );
// Check setup
EXPECT_EQ(4098u, mesh_.n_vertices() ) << "Wrong number of vertices after subdivision with loop";
EXPECT_EQ(8192u, mesh_.n_faces() ) << "Wrong number of faces after subdivision with loop";
}
TEST_F(OpenMeshSubdividerUniform_Triangle, Modified_Butterfly_delete_vertex) {
for (bool collect_garbage : { false, true })