Merge branch 'CustomProperties' of https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh into CustomProperties
This commit is contained in:
@@ -7,7 +7,7 @@ endif()
|
||||
if ( BUILD_APPS )
|
||||
|
||||
# Only build and fixbundle apps, when we are building OpenMesh standalone
|
||||
if(${PROJECT_NAME} MATCHES "OpenMesh")
|
||||
if(${CMAKE_PROJECT_NAME} MATCHES "OpenMesh")
|
||||
|
||||
if ( WIN32 AND OPENMESH_BUILD_SHARED )
|
||||
add_definitions(-DOPENMESHDLL )
|
||||
|
||||
@@ -25,7 +25,7 @@ vci_append_files (headers "*.hh" ${directories})
|
||||
vci_append_files (sources "*.cc" ${directories})
|
||||
|
||||
# Disable Library installation when not building OpenMesh on its own but as part of another project!
|
||||
if ( NOT ${PROJECT_NAME} MATCHES "OpenMesh")
|
||||
if ( NOT ${CMAKE_PROJECT_NAME} MATCHES "OpenMesh")
|
||||
set(VCI_NO_LIBRARY_INSTALL true)
|
||||
endif()
|
||||
|
||||
@@ -42,8 +42,8 @@ if (WIN32)
|
||||
|
||||
else ()
|
||||
vci_add_library (OpenMeshCore SHAREDANDSTATIC ${sources} ${headers})
|
||||
set_target_properties (OpenMeshCore PROPERTIES VERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR}
|
||||
SOVERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} )
|
||||
set_target_properties (OpenMeshCore PROPERTIES VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} )
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
@@ -51,7 +51,7 @@ if (MSVC)
|
||||
endif ()
|
||||
|
||||
# Add core as dependency before fixbundle
|
||||
if ( (${PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS )
|
||||
if ( (${CMAKE_PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS )
|
||||
|
||||
if ( WIN32 )
|
||||
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
|
||||
@@ -68,7 +68,7 @@ if ( (${PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS )
|
||||
endif()
|
||||
|
||||
# if we build debug and release in the same dir, we want to install both!
|
||||
if ( ${PROJECT_NAME} MATCHES "OpenMesh")
|
||||
if ( ${CMAKE_PROJECT_NAME} MATCHES "OpenMesh")
|
||||
if ( WIN32 )
|
||||
FILE(GLOB files_install_libs "${CMAKE_BINARY_DIR}/Build/lib/*.lib" )
|
||||
FILE(GLOB files_install_dlls "${CMAKE_BINARY_DIR}/Build/*.dll" )
|
||||
@@ -104,7 +104,13 @@ endif()
|
||||
|
||||
|
||||
# Only install if the project name matches OpenMesh.
|
||||
if (NOT APPLE AND ${PROJECT_NAME} MATCHES "OpenMesh")
|
||||
if (${CMAKE_PROJECT_NAME} MATCHES "OpenMesh")
|
||||
set (OPENMESH_NO_INSTALL_HEADERS FALSE CACHE BOOL "Should OpenMesh skip installing headers?")
|
||||
else()
|
||||
set (OPENMESH_NO_INSTALL_HEADERS TRUE CACHE BOOL "Should OpenMesh skip installing headers?")
|
||||
endif()
|
||||
|
||||
if (NOT APPLE AND NOT ${OPENMESH_NO_INSTALL_HEADERS})
|
||||
|
||||
# Install Header Files)
|
||||
install(DIRECTORY .
|
||||
|
||||
@@ -304,6 +304,14 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
|
||||
|
||||
SmartFaceHandle PolyConnectivity::add_face(VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2, VertexHandle _vh3)
|
||||
{
|
||||
// Check if we have been given a degenerate configuration (2 vertices are identical)
|
||||
assert(_vh0!=_vh1);
|
||||
assert(_vh0!=_vh2);
|
||||
assert(_vh1!=_vh2);
|
||||
assert(_vh0!=_vh3);
|
||||
assert(_vh1!=_vh3);
|
||||
assert(_vh2!=_vh3);
|
||||
|
||||
VertexHandle vhs[4] = { _vh0, _vh1, _vh2, _vh3 };
|
||||
return add_face(vhs, 4);
|
||||
}
|
||||
@@ -312,6 +320,11 @@ SmartFaceHandle PolyConnectivity::add_face(VertexHandle _vh0, VertexHandle _vh1,
|
||||
|
||||
SmartFaceHandle PolyConnectivity::add_face(VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2)
|
||||
{
|
||||
// Check if we have been given a degenerate configuration (2 vertices are identical)
|
||||
assert(_vh0!=_vh1);
|
||||
assert(_vh0!=_vh2);
|
||||
assert(_vh1!=_vh2);
|
||||
|
||||
VertexHandle vhs[3] = { _vh0, _vh1, _vh2 };
|
||||
return add_face(vhs, 3);
|
||||
}
|
||||
|
||||
@@ -205,6 +205,10 @@ public:
|
||||
* \brief Adds a new vertex initialized to a custom position.
|
||||
*
|
||||
* \sa new_vertex(), new_vertex_dirty()
|
||||
*
|
||||
* \attention Be careful to not use a reference to a point in the mesh itself here.
|
||||
* as a resize of the underlying vector might invalidate this reference
|
||||
* and cause a segfault.
|
||||
*/
|
||||
inline SmartVertexHandle new_vertex(const Point& _p)
|
||||
{
|
||||
@@ -231,7 +235,13 @@ public:
|
||||
return make_smart(vh, this);
|
||||
}
|
||||
|
||||
/// Alias for new_vertex(const Point&).
|
||||
/** Alias for new_vertex(const Point&).
|
||||
*
|
||||
* \attention Be careful to not use a reference to a point in the mesh itself here.
|
||||
* as a resize of the underlying vector might invalidate this reference
|
||||
* and cause a segfault.
|
||||
*
|
||||
*/
|
||||
inline SmartVertexHandle add_vertex(const Point& _p)
|
||||
{ return new_vertex(_p); }
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ IF(WIN32 AND NOT MINGW)
|
||||
ENDIF(WIN32 AND NOT MINGW)
|
||||
|
||||
# Disable Library installation when not building OpenMesh on its own but as part of another project!
|
||||
if ( NOT ${PROJECT_NAME} MATCHES "OpenMesh")
|
||||
if ( NOT ${CMAKE_PROJECT_NAME} MATCHES "OpenMesh")
|
||||
set(VCI_NO_LIBRARY_INSTALL true)
|
||||
endif()
|
||||
|
||||
@@ -44,8 +44,8 @@ if (WIN32)
|
||||
|
||||
else ()
|
||||
vci_add_library (OpenMeshTools SHAREDANDSTATIC ${sources} ${headers})
|
||||
set_target_properties (OpenMeshTools PROPERTIES VERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR}
|
||||
SOVERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} )
|
||||
set_target_properties (OpenMeshTools PROPERTIES VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} )
|
||||
endif ()
|
||||
|
||||
target_link_libraries (OpenMeshTools OpenMeshCore)
|
||||
@@ -54,7 +54,7 @@ IF( NOT WIN32 )
|
||||
target_link_libraries (OpenMeshToolsStatic OpenMeshCoreStatic)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
if ( (${PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS )
|
||||
if ( (${CMAKE_PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS )
|
||||
|
||||
if ( WIN32 )
|
||||
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
|
||||
@@ -97,7 +97,13 @@ endif()
|
||||
|
||||
|
||||
# Only install if the project name matches OpenMesh.
|
||||
if (NOT APPLE AND ${PROJECT_NAME} MATCHES "OpenMesh")
|
||||
if (${CMAKE_PROJECT_NAME} MATCHES "OpenMesh")
|
||||
set (OPENMESH_NO_INSTALL_HEADERS FALSE CACHE BOOL "Should OpenMesh skip installing headers?")
|
||||
else()
|
||||
set (OPENMESH_NO_INSTALL_HEADERS TRUE CACHE BOOL "Should OpenMesh skip installing headers?")
|
||||
endif()
|
||||
|
||||
if (NOT APPLE AND NOT ${OPENMESH_NO_INSTALL_HEADERS})
|
||||
|
||||
# Install Header Files
|
||||
install(DIRECTORY .
|
||||
|
||||
@@ -179,6 +179,17 @@ protected:
|
||||
|
||||
///TODO:Implement fixed positions
|
||||
|
||||
// Compute the maximal vertex valence in the mesh
|
||||
unsigned int maxValence = 0;
|
||||
for ( auto vertex : _m.vertices() ) {
|
||||
maxValence = std::max(maxValence,_m.valence(vertex));
|
||||
}
|
||||
|
||||
// We pre initialized with 30. If it's larger, we update the weights
|
||||
if (maxValence >= 30) {
|
||||
init_weights( maxValence + 1 );
|
||||
}
|
||||
|
||||
// Do _n subdivisions
|
||||
for (size_t i=0; i < _n; ++i)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
BIN
src/Unittests/TestFiles/cylinder.om
Normal file
BIN
src/Unittests/TestFiles/cylinder.om
Normal file
Binary file not shown.
@@ -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";
|
||||
|
||||
65
src/Unittests/unittests_set_positions_directly.cc
Normal file
65
src/Unittests/unittests_set_positions_directly.cc
Normal 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";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user