2 #include <gtest/gtest.h>
3 #include <Unittests/unittests_common.hh>
9 class OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement :
public OpenMeshBase {
14 virtual void SetUp() {
18 virtual void TearDown() {
38 TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, dereference) {
52 std::vector<Mesh::VertexHandle> face_vhandles;
54 face_vhandles.push_back(vhandle[0]);
55 face_vhandles.push_back(vhandle[1]);
56 face_vhandles.push_back(vhandle[2]);
57 mesh_.add_face(face_vhandles);
59 face_vhandles.clear();
61 face_vhandles.push_back(vhandle[1]);
62 face_vhandles.push_back(vhandle[3]);
63 face_vhandles.push_back(vhandle[4]);
64 mesh_.add_face(face_vhandles);
66 face_vhandles.clear();
68 face_vhandles.push_back(vhandle[0]);
69 face_vhandles.push_back(vhandle[3]);
70 face_vhandles.push_back(vhandle[1]);
71 mesh_.add_face(face_vhandles);
73 face_vhandles.clear();
75 face_vhandles.push_back(vhandle[2]);
76 face_vhandles.push_back(vhandle[1]);
77 face_vhandles.push_back(vhandle[4]);
78 mesh_.add_face(face_vhandles);
91 int current_halfedge_handles[12] = {
92 4,0,2,10,6,8,1,12,7,14,3,11
97 for (Mesh::FaceIter f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it) {
99 EXPECT_EQ(current_halfedge_handles[i], fh_it->idx() ) <<
"halfedge handles don't match";
107 TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, vv_iter) {
121 std::vector<Mesh::VertexHandle> face_vhandles;
123 face_vhandles.push_back(vhandle[0]);
124 face_vhandles.push_back(vhandle[1]);
125 face_vhandles.push_back(vhandle[2]);
126 mesh_.add_face(face_vhandles);
128 face_vhandles.clear();
130 face_vhandles.push_back(vhandle[1]);
131 face_vhandles.push_back(vhandle[3]);
132 face_vhandles.push_back(vhandle[4]);
133 mesh_.add_face(face_vhandles);
135 face_vhandles.clear();
137 face_vhandles.push_back(vhandle[0]);
138 face_vhandles.push_back(vhandle[3]);
139 face_vhandles.push_back(vhandle[1]);
140 mesh_.add_face(face_vhandles);
142 face_vhandles.clear();
144 face_vhandles.push_back(vhandle[2]);
145 face_vhandles.push_back(vhandle[1]);
146 face_vhandles.push_back(vhandle[4]);
147 mesh_.add_face(face_vhandles);
160 size_t current_halfedge_handles[16] = {
179 std::vector<Mesh::EdgeHandle> eh0;
180 std::vector<Mesh::EdgeHandle> eh1;
182 for (Mesh::VertexIter v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it) {
184 eh0.push_back(mesh_.edge_handle(Mesh::HalfedgeHandle(
int(current_halfedge_handles[i]))));
186 for (Mesh::VertexIter v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it) {
188 eh1.push_back(mesh_.edge_handle(*voh_it));
191 EXPECT_EQ(eh0.size(), eh1.size()) <<
"size of vectors does not match";
192 for (
size_t i = 0; i < eh0.size(); ++i)
193 EXPECT_EQ(eh0[i], eh1[i]) <<
"edge handles do not match";
200 TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, fe_iter) {
214 std::vector<Mesh::VertexHandle> face_vhandles;
216 face_vhandles.push_back(vhandle[0]);
217 face_vhandles.push_back(vhandle[1]);
218 face_vhandles.push_back(vhandle[2]);
219 mesh_.add_face(face_vhandles);
221 face_vhandles.clear();
223 face_vhandles.push_back(vhandle[1]);
224 face_vhandles.push_back(vhandle[3]);
225 face_vhandles.push_back(vhandle[4]);
226 mesh_.add_face(face_vhandles);
228 face_vhandles.clear();
230 face_vhandles.push_back(vhandle[0]);
231 face_vhandles.push_back(vhandle[3]);
232 face_vhandles.push_back(vhandle[1]);
233 mesh_.add_face(face_vhandles);
235 face_vhandles.clear();
237 face_vhandles.push_back(vhandle[2]);
238 face_vhandles.push_back(vhandle[1]);
239 face_vhandles.push_back(vhandle[4]);
240 mesh_.add_face(face_vhandles);
253 size_t current_halfedge_handles[12] = {
254 4,0,2,10,6,8,1,12,7,14,3,11
259 std::vector<Mesh::HalfedgeHandle> heh0;
260 std::vector<Mesh::HalfedgeHandle> heh1;
262 for (Mesh::FaceIter f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it) {
263 for (
Mesh::FaceEdgeIter fe_it = mesh_.fe_iter(*f_it); fe_it.is_valid(); ++fe_it, ++i) {
264 heh0.push_back(Mesh::HalfedgeHandle(
int(current_halfedge_handles[i])));
267 for (Mesh::FaceIter f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it) {
269 heh1.push_back(*fh_it);
273 EXPECT_EQ(heh0.size(), heh1.size()) <<
"size of vectors does not match";
274 for (
size_t i = 0; i < heh0.size(); ++i)
275 EXPECT_EQ(heh0[i], heh1[i]) <<
"halfedge handles do not match";
282 TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, vf_iter_boundary) {
297 std::vector<Mesh::VertexHandle> face_vhandles;
299 face_vhandles.push_back(vhandle[0]);
300 face_vhandles.push_back(vhandle[1]);
301 face_vhandles.push_back(vhandle[2]);
302 mesh_.add_face(face_vhandles);
304 face_vhandles.clear();
306 face_vhandles.push_back(vhandle[2]);
307 face_vhandles.push_back(vhandle[3]);
308 face_vhandles.push_back(vhandle[4]);
309 mesh_.add_face(face_vhandles);
311 face_vhandles.clear();
313 face_vhandles.push_back(vhandle[1]);
314 face_vhandles.push_back(vhandle[5]);
315 face_vhandles.push_back(vhandle[3]);
316 mesh_.add_face(face_vhandles);
331 size_t current_halfedge_handles[9] = {
332 0,2,12,4,6,8,16,10,14
334 std::vector<Mesh::FaceHandle> fh0;
335 std::vector<Mesh::FaceHandle> fh1;
337 for (Mesh::VertexIter v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it) {
339 fh0.push_back(mesh_.face_handle(Mesh::HalfedgeHandle(current_halfedge_handles[i])));
341 for (Mesh::VertexIter v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it) {
343 fh1.push_back(*vf_it);
346 EXPECT_EQ(fh0.size(), fh1.size()) <<
"size of vectors does not match";
347 for (
size_t i = 0; i < fh0.size(); ++i)
348 EXPECT_EQ(fh0[i], fh1[i]) <<
"face handles do not match";
Kernel::FaceEdgeIter FaceEdgeIter
Circulator.
Kernel::VertexVertexIter VertexVertexIter
Circulator.
Kernel::Point Point
Coordinate type.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Kernel::VertexOHalfedgeIter VertexOHalfedgeIter
Circulator.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Kernel::FaceHalfedgeIter FaceHalfedgeIter
Circulator.
Kernel::VertexFaceIter VertexFaceIter
Circulator.