2#include <gtest/gtest.h>
3#include <Unittests/unittests_common.hh>
8class OpenMeshSplitEdgeCopyTriangleMesh :
public OpenMeshBase {
13 virtual void SetUp() {
19 virtual void TearDown() {
33 virtual void SetUp() {
39 virtual void TearDown() {
57TEST_F(OpenMeshSplitEdgeCopyTriangleMesh, SplitEdgeCopyTriangleMesh) {
60 mesh_.request_edge_status();
71 std::vector<Mesh::VertexHandle> face_vhandles;
73 face_vhandles.push_back(vhandle[2]);
74 face_vhandles.push_back(vhandle[1]);
75 face_vhandles.push_back(vhandle[0]);
89 mesh_.add_property(eprop_int);
90 mesh_.property(eprop_int, eh) = 999;
92 mesh_.status(eh).set_tagged(
true);
98 Mesh::EdgeHandle eh0 = mesh_.edge_handle( mesh_.next_halfedge_handle( mesh_.halfedge_handle(eh, 1) ) );
99 EXPECT_EQ(999, mesh_.property(eprop_int, eh0)) <<
"Different Property value";
100 EXPECT_TRUE(mesh_.status(eh0).tagged()) <<
"Different internal property value";
102 EXPECT_EQ(3u, mesh_.valence(fh)) <<
"Face of TriMesh has valence other than 3";
108TEST_F(OpenMeshSplitEdgeCopyPolyMesh, SplitEdgeCopyPolymesh) {
111 mesh_.request_edge_status();
123 std::vector<Mesh::VertexHandle> face_vhandles;
125 face_vhandles.push_back(vhandle[0]);
126 face_vhandles.push_back(vhandle[1]);
127 face_vhandles.push_back(vhandle[2]);
128 face_vhandles.push_back(vhandle[3]);
130 mesh_.add_face(face_vhandles);
142 mesh_.add_property(eprop_int);
143 mesh_.property(eprop_int, eh) = 999;
145 mesh_.status(eh).set_tagged(
true);
149 mesh_.split_edge_copy(eh, vhandle[4]);
153 Mesh::EdgeHandle eh0 = mesh_.edge_handle( mesh_.next_halfedge_handle( mesh_.halfedge_handle(eh, 1) ) );
154 EXPECT_EQ(999, mesh_.property(eprop_int, eh0)) <<
"Different Property value";
155 EXPECT_TRUE(mesh_.status(eh0).tagged()) <<
"Different internal property value";
162TEST_F(OpenMeshSplitEdgeCopyTriangleMesh, SplitEdgeCopyFacePropertiesTriangleMesh) {
165 mesh_.request_edge_status();
166 mesh_.request_face_status();
168 static_assert(std::is_same<
decltype (mesh_),
Mesh>::value,
"Mesh is not a triangle mesh");
182 std::vector<Mesh::VertexHandle> face_vhandles;
183 face_vhandles.push_back(vhandle[2]);
184 face_vhandles.push_back(vhandle[1]);
185 face_vhandles.push_back(vhandle[0]);
189 face_vhandles.clear();
190 face_vhandles.push_back(vhandle[2]);
191 face_vhandles.push_back(vhandle[0]);
192 face_vhandles.push_back(vhandle[3]);
198 EXPECT_EQ(mesh_.n_faces(), 2u);
209 mesh_.add_property(fprop_int);
210 mesh_.property(fprop_int, fh0) = 13;
211 mesh_.property(fprop_int, fh1) = 17;
213 mesh_.status(fh0).set_tagged(
true);
218 EXPECT_EQ(mesh_.n_faces(), 4u);
220 for (
auto fh : mesh_.faces())
222 EXPECT_EQ(3u, mesh_.valence(fh));
231 EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(heh21))) <<
"Different Property value";
232 EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(heh10))) <<
"Different Property value";
233 EXPECT_EQ(17, mesh_.property(fprop_int, mesh_.face_handle(heh03))) <<
"Different Property value";
234 EXPECT_EQ(17, mesh_.property(fprop_int, mesh_.face_handle(heh32))) <<
"Different Property value";
235 EXPECT_TRUE(mesh_.status(mesh_.face_handle(heh21)).tagged()) <<
"Different internal property value";
236 EXPECT_TRUE(mesh_.status(mesh_.face_handle(heh10)).tagged()) <<
"Different internal property value";
237 EXPECT_FALSE(mesh_.status(mesh_.face_handle(heh03)).tagged()) <<
"Different internal property value";
238 EXPECT_FALSE(mesh_.status(mesh_.face_handle(heh32)).tagged()) <<
"Different internal property value";
244 mesh_.
split_copy(boundary_edge, boundary_vertex);
249 EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(heh1b))) <<
"Different Property value";
250 EXPECT_EQ(13, mesh_.property(fprop_int, mesh_.face_handle(hehb0))) <<
"Different Property value";
251 EXPECT_TRUE(mesh_.status(mesh_.face_handle(heh1b)).tagged()) <<
"Different internal property value";
252 EXPECT_TRUE(mesh_.status(mesh_.face_handle(hehb0)).tagged()) <<
"Different internal property value";
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Kernel::EdgeHandle EdgeHandle
Scalar type.
SmartVertexHandle add_vertex(const Point _p)
Kernel::FaceHandle FaceHandle
Scalar type.
Kernel::HalfedgeHandle HalfedgeHandle
Scalar type.
Kernel::Point Point
Coordinate type.
SmartVertexHandle split_copy(EdgeHandle _eh, const Point &_p)
Edge split (= 2-to-4 split)