Merge branch 'master' into CustomProperties

This commit is contained in:
Jan
2021-02-17 17:16:37 +01:00
33 changed files with 855 additions and 246 deletions

View File

@@ -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 )

View File

@@ -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 .

View File

@@ -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);
}

View File

@@ -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); }

View File

@@ -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 .

View File

@@ -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)
{