Merge branch 'compile-time-connectivity-type' into 'master'
Compile time connectivity type See merge request OpenMesh/OpenMesh!188
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>TriConnectivity: Added two functions split_edge and split_edge_copy to mask the PolyConnectivity functions of the same name (Prevents creation of valence 2 vertices on trimeshes)</li>
|
<li>TriConnectivity: Added two functions split_edge and split_edge_copy to mask the PolyConnectivity functions of the same name (Prevents creation of valence 2 vertices on trimeshes)</li>
|
||||||
<li>PolyConnectivity: Fixed PolyConnectivity is_collapse_ok, missing some configurations (Thanks to Simon Flöry for the patch)</li>
|
<li>PolyConnectivity: Fixed PolyConnectivity is_collapse_ok, missing some configurations (Thanks to Simon Flöry for the patch)</li>
|
||||||
|
<li>Connectivity type is now set at compile time</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<b>IO</b>
|
<b>IO</b>
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
#include <OpenMesh/Core/Geometry/MathDefs.hh>
|
#include <OpenMesh/Core/Geometry/MathDefs.hh>
|
||||||
#include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
|
#include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
|
||||||
#include <OpenMesh/Core/Mesh/FinalMeshItemsT.hh>
|
#include <OpenMesh/Core/Mesh/FinalMeshItemsT.hh>
|
||||||
|
#include <OpenMesh/Core/Mesh/Tags.hh>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
@@ -95,11 +96,12 @@ public:
|
|||||||
//--- item types ---
|
//--- item types ---
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/// Determine whether this is a PolyMeshT or TriMeshT ( This function does not check the per face vertex count! It only checks if the datatype is PolyMeshT or TriMeshT )
|
/// Determine whether this is a PolyMeshT or TriMeshT (This function does not check the per face vertex count! It only checks if the datatype is PolyMeshT or TriMeshT)
|
||||||
|
static constexpr bool is_polymesh() { return true; }
|
||||||
|
static constexpr bool is_trimesh() { return false; }
|
||||||
|
using ConnectivityTag = PolyConnectivityTag;
|
||||||
enum { IsPolyMesh = 1 };
|
enum { IsPolyMesh = 1 };
|
||||||
enum { IsTriMesh = 0 };
|
enum { IsTriMesh = 0 };
|
||||||
static bool is_polymesh() { return true; }
|
|
||||||
static bool is_trimesh() { return false; }
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// \name Mesh Items
|
/// \name Mesh Items
|
||||||
|
|||||||
52
src/OpenMesh/Core/Mesh/Tags.hh
Normal file
52
src/OpenMesh/Core/Mesh/Tags.hh
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* ========================================================================= *
|
||||||
|
* *
|
||||||
|
* OpenMesh *
|
||||||
|
* Copyright (c) 2001-2015, RWTH-Aachen University *
|
||||||
|
* Department of Computer Graphics and Multimedia *
|
||||||
|
* All rights reserved. *
|
||||||
|
* www.openmesh.org *
|
||||||
|
* *
|
||||||
|
*---------------------------------------------------------------------------*
|
||||||
|
* This file is part of OpenMesh. *
|
||||||
|
*---------------------------------------------------------------------------*
|
||||||
|
* *
|
||||||
|
* Redistribution and use in source and binary forms, with or without *
|
||||||
|
* modification, are permitted provided that the following conditions *
|
||||||
|
* are met: *
|
||||||
|
* *
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, *
|
||||||
|
* this list of conditions and the following disclaimer. *
|
||||||
|
* *
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright *
|
||||||
|
* notice, this list of conditions and the following disclaimer in the *
|
||||||
|
* documentation and/or other materials provided with the distribution. *
|
||||||
|
* *
|
||||||
|
* 3. Neither the name of the copyright holder nor the names of its *
|
||||||
|
* contributors may be used to endorse or promote products derived from *
|
||||||
|
* this software without specific prior written permission. *
|
||||||
|
* *
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
|
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||||
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
|
||||||
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||||
|
* *
|
||||||
|
* ========================================================================= */
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace OpenMesh {
|
||||||
|
|
||||||
|
/// Connectivity tag indicating that the tagged mesh has polygon connectivity.
|
||||||
|
struct PolyConnectivityTag {};
|
||||||
|
/// Connectivity tag indicating that the tagged mesh has triangle connectivity.
|
||||||
|
struct TriConnectivityTag {};
|
||||||
|
|
||||||
|
} // namespace OpenMesh
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
#include <OpenMesh/Core/System/config.h>
|
#include <OpenMesh/Core/System/config.h>
|
||||||
#include <OpenMesh/Core/Mesh/PolyMeshT.hh>
|
#include <OpenMesh/Core/Mesh/PolyMeshT.hh>
|
||||||
|
#include <OpenMesh/Core/Mesh/Tags.hh>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
@@ -98,11 +99,12 @@ public:
|
|||||||
typedef PolyMeshT<Kernel> PolyMesh;
|
typedef PolyMeshT<Kernel> PolyMesh;
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
/// Determine whether this is a PolyMeshT or TriMeshT ( This function does not check the per face vertex count! It only checks if the datatype is PolyMeshT or TriMeshT )
|
/// Determine whether this is a PolyMeshT or TriMeshT (This function does not check the per face vertex count! It only checks if the datatype is PolyMeshT or TriMeshT)
|
||||||
|
static constexpr bool is_polymesh() { return false; }
|
||||||
|
static constexpr bool is_trimesh() { return true; }
|
||||||
|
using ConnectivityTag = TriConnectivityTag;
|
||||||
enum { IsPolyMesh = 0 };
|
enum { IsPolyMesh = 0 };
|
||||||
enum { IsTriMesh = 1 };
|
enum { IsTriMesh = 1 };
|
||||||
static bool is_polymesh() { return false; }
|
|
||||||
static bool is_trimesh() { return true; }
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//--- items ---
|
//--- items ---
|
||||||
|
|||||||
67
src/Unittests/unittests_mesh_type.cc
Normal file
67
src/Unittests/unittests_mesh_type.cc
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <Unittests/unittests_common.hh>
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
|
class OpenMeshTypeTest_Poly : public OpenMeshBasePoly {
|
||||||
|
|
||||||
|
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...
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class OpenMeshTypeTest_Triangle : 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...
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ====================================================================
|
||||||
|
* Define tests below
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
TEST_F(OpenMeshTypeTest_Triangle, testTypeFunctions) {
|
||||||
|
|
||||||
|
|
||||||
|
EXPECT_TRUE(mesh_.is_trimesh()) << "Type Error!";
|
||||||
|
EXPECT_FALSE(mesh_.is_polymesh()) << "Type Error!";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(OpenMeshTypeTest_Poly, testTypeFunctions) {
|
||||||
|
|
||||||
|
|
||||||
|
EXPECT_FALSE(mesh_.is_trimesh()) << "Type Error!";
|
||||||
|
EXPECT_TRUE(mesh_.is_polymesh()) << "Type Error!";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user