test_mesh_data.cpp
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  * Point Cloud Library (PCL) - www.pointclouds.org
00005  * Copyright (c) 2009-2012, Willow Garage, Inc.
00006  * Copyright (c) 2012-, Open Perception, Inc.
00007  *
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  *
00014  *  * Redistributions of source code must retain the above copyright
00015  *    notice, this list of conditions and the following disclaimer.
00016  *  * Redistributions in binary form must reproduce the above
00017  *    copyright notice, this list of conditions and the following
00018  *    disclaimer in the documentation and/or other materials provided
00019  *    with the distribution.
00020  *  * Neither the name of the copyright holder(s) nor the names of its
00021  *    contributors may be used to endorse or promote products derived
00022  *    from this software without specific prior written permission.
00023  *
00024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00026  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00027  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00028  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00029  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00030  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00031  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00033  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00034  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  * POSSIBILITY OF SUCH DAMAGE.
00036  *
00037  * $Id$
00038  *
00039  */
00040 
00041 #include <gtest/gtest.h>
00042 
00043 #include "test_mesh_common_functions.h"
00044 #include <pcl/geometry/polygon_mesh.h>
00045 
00047 
00048 typedef pcl::geometry::NoData NoData;
00049 typedef pcl::geometry::DefaultMeshTraits <int   , NoData , NoData, NoData> TraitsV;
00050 typedef pcl::geometry::DefaultMeshTraits <NoData, int    , NoData, NoData> TraitsHE;
00051 typedef pcl::geometry::DefaultMeshTraits <NoData, NoData , int   , NoData> TraitsE;
00052 typedef pcl::geometry::DefaultMeshTraits <NoData, NoData , NoData, int   > TraitsF;
00053 typedef pcl::geometry::DefaultMeshTraits <int   , int    , int   , int   > TraitsAD;
00054 
00055 typedef pcl::geometry::PolygonMesh <TraitsV>  MeshV;
00056 typedef pcl::geometry::PolygonMesh <TraitsHE> MeshHE;
00057 typedef pcl::geometry::PolygonMesh <TraitsE>  MeshE;
00058 typedef pcl::geometry::PolygonMesh <TraitsF>  MeshF;
00059 typedef pcl::geometry::PolygonMesh <TraitsAD> MeshAD;
00060 
00061 typedef pcl::geometry::VertexIndex   VertexIndex;
00062 typedef pcl::geometry::HalfEdgeIndex HalfEdgeIndex;
00063 typedef pcl::geometry::EdgeIndex     EdgeIndex;
00064 typedef pcl::geometry::FaceIndex     FaceIndex;
00065 
00066 typedef std::vector <VertexIndex>   VertexIndices;
00067 typedef std::vector <HalfEdgeIndex> HalfEdgeIndices;
00068 typedef std::vector <FaceIndex>     FaceIndices;
00069 
00071 
00073 template <class MeshT> void
00074 checkSizeElements (const MeshT& mesh, const size_t n_v, const size_t n_e, const size_t n_f)
00075 {
00076   ASSERT_EQ (n_v, mesh.sizeVertices ());
00077   ASSERT_EQ (n_e, mesh.sizeEdges ());
00078   ASSERT_EQ (n_f, mesh.sizeFaces ());
00079 }
00080 
00082 
00084 template <class MeshT> void
00085 checkSizeData (const MeshT& mesh, const size_t n_v, const size_t n_he, const size_t n_e, const size_t n_f)
00086 {
00087   ASSERT_EQ (n_v , mesh.getVertexDataCloud   ().size ());
00088   ASSERT_EQ (n_he, mesh.getHalfEdgeDataCloud ().size ());
00089   ASSERT_EQ (n_e , mesh.getEdgeDataCloud     ().size ());
00090   ASSERT_EQ (n_f , mesh.getFaceDataCloud     ().size ());
00091 }
00092 
00094 
00095 TEST (TestMesh, MeshData)
00096 {
00097   EXPECT_TRUE  (MeshV::HasVertexData::value);
00098   EXPECT_FALSE (MeshV::HasHalfEdgeData::value);
00099   EXPECT_FALSE (MeshV::HasEdgeData::value);
00100   EXPECT_FALSE (MeshV::HasFaceData::value);
00101 
00102   EXPECT_FALSE (MeshHE::HasVertexData::value);
00103   EXPECT_TRUE  (MeshHE::HasHalfEdgeData::value);
00104   EXPECT_FALSE (MeshHE::HasEdgeData::value);
00105   EXPECT_FALSE (MeshHE::HasFaceData::value);
00106 
00107   EXPECT_FALSE (MeshE::HasVertexData::value);
00108   EXPECT_FALSE (MeshE::HasHalfEdgeData::value);
00109   EXPECT_TRUE  (MeshE::HasEdgeData::value);
00110   EXPECT_FALSE (MeshE::HasFaceData::value);
00111 
00112   EXPECT_FALSE (MeshF::HasVertexData::value);
00113   EXPECT_FALSE (MeshF::HasHalfEdgeData::value);
00114   EXPECT_FALSE (MeshF::HasEdgeData::value);
00115   EXPECT_TRUE  (MeshF::HasFaceData::value);
00116 
00117   EXPECT_TRUE (MeshAD::HasVertexData::value);
00118   EXPECT_TRUE (MeshAD::HasHalfEdgeData::value);
00119   EXPECT_TRUE (MeshAD::HasEdgeData::value);
00120   EXPECT_TRUE (MeshAD::HasFaceData::value);
00121 
00122   // 3 - 2 - 4 //
00123   //  \ / \ /  //
00124   //   0 - 1   //
00125   VertexIndices vi_0, vi_1, vi_2;
00126   vi_0.push_back (VertexIndex (0)); vi_0.push_back (VertexIndex (1)); vi_0.push_back (VertexIndex (2));
00127   vi_1.push_back (VertexIndex (0)); vi_1.push_back (VertexIndex (2)); vi_1.push_back (VertexIndex (3));
00128   vi_2.push_back (VertexIndex (4)); vi_2.push_back (VertexIndex (2)); vi_2.push_back (VertexIndex (1));
00129 
00130   // Mesh data.
00131   int vd_0  (10), vd_1  (11), vd_2  (12), vd_3 (13), vd_4 (14);
00132   int hed_0 (20), hed_1 (21), hed_2 (22);
00133   int ed_0  (30), ed_1  (31), ed_2  (32);
00134   int fd_0  (40), fd_1  (41), fd_2  (42);
00135   NoData nd;
00136 
00137   {
00138     SCOPED_TRACE ("Mesh with vertex data");
00139     MeshV mesh;
00140 
00141     EXPECT_TRUE (mesh.addVertex (vd_0).isValid ());
00142     EXPECT_TRUE (mesh.addVertex (vd_1).isValid ());
00143     EXPECT_TRUE (mesh.addVertex (vd_2).isValid ());
00144     EXPECT_TRUE (mesh.addVertex (vd_3).isValid ());
00145     EXPECT_TRUE (mesh.addVertex (vd_4).isValid ());
00146 
00147     EXPECT_TRUE (mesh.addFace (vi_0, nd, nd, nd).isValid ());
00148     EXPECT_TRUE (mesh.addFace (vi_1, nd, nd, nd).isValid ());
00149     EXPECT_TRUE (mesh.addFace (vi_2, nd, nd, nd).isValid ());
00150 
00151     checkSizeElements (mesh, 5,    7, 3);
00152     checkSizeData     (mesh, 5, 0, 0, 0);
00153 
00154     EXPECT_EQ (vd_0, mesh.getVertexDataCloud () [0]);
00155     EXPECT_EQ (vd_1, mesh.getVertexDataCloud () [1]);
00156     EXPECT_EQ (vd_2, mesh.getVertexDataCloud () [2]);
00157     EXPECT_EQ (vd_3, mesh.getVertexDataCloud () [3]);
00158     EXPECT_EQ (vd_4, mesh.getVertexDataCloud () [4]);
00159 
00160     mesh.deleteFace (FaceIndex (1));
00161     mesh.cleanUp ();
00162 
00163     checkSizeElements (mesh, 4,    5, 2);
00164     checkSizeData     (mesh, 4, 0, 0, 0);
00165 
00166     EXPECT_EQ (vd_0, mesh.getVertexDataCloud () [0]);
00167     EXPECT_EQ (vd_1, mesh.getVertexDataCloud () [1]);
00168     EXPECT_EQ (vd_2, mesh.getVertexDataCloud () [2]);
00169     EXPECT_EQ (vd_4, mesh.getVertexDataCloud () [3]);
00170   }
00171 
00172   {
00173     SCOPED_TRACE ("Mesh with edge data");
00174     MeshE mesh;
00175 
00176     EXPECT_TRUE (mesh.addVertex ().isValid ());
00177     EXPECT_TRUE (mesh.addVertex ().isValid ());
00178     EXPECT_TRUE (mesh.addVertex ().isValid ());
00179     EXPECT_TRUE (mesh.addVertex ().isValid ());
00180     EXPECT_TRUE (mesh.addVertex ().isValid ());
00181 
00182     EXPECT_TRUE (mesh.addFace (vi_0, nd, ed_0, nd).isValid ());
00183     EXPECT_TRUE (mesh.addFace (vi_1, nd, ed_1, nd).isValid ());
00184     EXPECT_TRUE (mesh.addFace (vi_2, nd, ed_2, nd).isValid ());
00185 
00186     checkSizeElements (mesh, 5,    7, 3);
00187     checkSizeData     (mesh, 0, 0, 7, 0);
00188 
00189     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [0]);
00190     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [1]);
00191     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [2]);
00192     EXPECT_EQ (ed_1, mesh.getEdgeDataCloud () [3]);
00193     EXPECT_EQ (ed_1, mesh.getEdgeDataCloud () [4]);
00194     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [5]);
00195     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [6]);
00196 
00197     mesh.deleteFace (FaceIndex (1));
00198     mesh.cleanUp ();
00199 
00200     checkSizeElements (mesh, 4,    5, 2);
00201     checkSizeData     (mesh, 0, 0, 5, 0);
00202 
00203     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [0]);
00204     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [1]);
00205     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [2]);
00206     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [3]);
00207     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [4]);
00208   }
00209 
00210   {
00211     SCOPED_TRACE ("Mesh with half-edge data");
00212     MeshHE mesh;
00213 
00214     EXPECT_TRUE (mesh.addVertex ().isValid ());
00215     EXPECT_TRUE (mesh.addVertex ().isValid ());
00216     EXPECT_TRUE (mesh.addVertex ().isValid ());
00217     EXPECT_TRUE (mesh.addVertex ().isValid ());
00218     EXPECT_TRUE (mesh.addVertex ().isValid ());
00219 
00220     EXPECT_TRUE (mesh.addFace (vi_0, nd, nd, hed_0).isValid ());
00221     EXPECT_TRUE (mesh.addFace (vi_1, nd, nd, hed_1).isValid ());
00222     EXPECT_TRUE (mesh.addFace (vi_2, nd, nd, hed_2).isValid ());
00223 
00224     checkSizeElements (mesh, 5,     7, 3);
00225     checkSizeData     (mesh, 0, 14, 0, 0);
00226 
00227     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 0]);
00228     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 1]);
00229     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 2]);
00230     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 3]);
00231     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 4]);
00232     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 5]);
00233     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 6]);
00234     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 7]);
00235     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 8]);
00236     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 9]);
00237     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [10]);
00238     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [11]);
00239     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [12]);
00240     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [13]);
00241 
00242     mesh.deleteFace (FaceIndex (1));
00243     mesh.cleanUp ();
00244 
00245     checkSizeElements (mesh, 4,     5, 2);
00246     checkSizeData     (mesh, 0, 10, 0, 0);
00247 
00248     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [0]);
00249     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [1]);
00250     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [2]);
00251     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [3]);
00252     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [4]);
00253     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [5]);
00254     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [6]);
00255     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [7]);
00256     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [8]);
00257     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [9]);
00258   }
00259 
00260   {
00261     SCOPED_TRACE ("Mesh with face data");
00262     MeshF mesh;
00263 
00264     EXPECT_TRUE (mesh.addVertex ().isValid ());
00265     EXPECT_TRUE (mesh.addVertex ().isValid ());
00266     EXPECT_TRUE (mesh.addVertex ().isValid ());
00267     EXPECT_TRUE (mesh.addVertex ().isValid ());
00268     EXPECT_TRUE (mesh.addVertex ().isValid ());
00269 
00270     EXPECT_TRUE (mesh.addFace (vi_0, fd_0, nd, nd).isValid ());
00271     EXPECT_TRUE (mesh.addFace (vi_1, fd_1, nd, nd).isValid ());
00272     EXPECT_TRUE (mesh.addFace (vi_2, fd_2, nd, nd).isValid ());
00273 
00274     checkSizeElements (mesh, 5,    7, 3);
00275     checkSizeData     (mesh, 0, 0, 0, 3);
00276 
00277     EXPECT_EQ (fd_0, mesh.getFaceDataCloud () [0]);
00278     EXPECT_EQ (fd_1, mesh.getFaceDataCloud () [1]);
00279     EXPECT_EQ (fd_2, mesh.getFaceDataCloud () [2]);
00280 
00281     mesh.deleteFace (FaceIndex (1));
00282     mesh.cleanUp ();
00283 
00284     checkSizeElements (mesh, 4,    5, 2);
00285     checkSizeData     (mesh, 0, 0, 0, 2);
00286 
00287     EXPECT_EQ (fd_0, mesh.getFaceDataCloud () [0]);
00288     EXPECT_EQ (fd_2, mesh.getFaceDataCloud () [1]);
00289   }
00290 
00291   {
00292     SCOPED_TRACE ("Mesh with all data");
00293     MeshAD mesh;
00294 
00295     EXPECT_TRUE (mesh.addVertex (vd_0).isValid ());
00296     EXPECT_TRUE (mesh.addVertex (vd_1).isValid ());
00297     EXPECT_TRUE (mesh.addVertex (vd_2).isValid ());
00298     EXPECT_TRUE (mesh.addVertex (vd_3).isValid ());
00299     EXPECT_TRUE (mesh.addVertex (vd_4).isValid ());
00300 
00301     EXPECT_TRUE (mesh.addFace (vi_0, fd_0, ed_0, hed_0).isValid ());
00302     EXPECT_TRUE (mesh.addFace (vi_1, fd_1, ed_1, hed_1).isValid ());
00303     EXPECT_TRUE (mesh.addFace (vi_2, fd_2, ed_2, hed_2).isValid ());
00304 
00305     checkSizeElements (mesh, 5,     7, 3);
00306     checkSizeData     (mesh, 5, 14, 7, 3);
00307 
00308     EXPECT_EQ (vd_0, mesh.getVertexDataCloud () [0]);
00309     EXPECT_EQ (vd_1, mesh.getVertexDataCloud () [1]);
00310     EXPECT_EQ (vd_2, mesh.getVertexDataCloud () [2]);
00311     EXPECT_EQ (vd_3, mesh.getVertexDataCloud () [3]);
00312     EXPECT_EQ (vd_4, mesh.getVertexDataCloud () [4]);
00313 
00314     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [0]);
00315     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [1]);
00316     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [2]);
00317     EXPECT_EQ (ed_1, mesh.getEdgeDataCloud () [3]);
00318     EXPECT_EQ (ed_1, mesh.getEdgeDataCloud () [4]);
00319     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [5]);
00320     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [6]);
00321 
00322     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 0]);
00323     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 1]);
00324     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 2]);
00325     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 3]);
00326     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 4]);
00327     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [ 5]);
00328     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 6]);
00329     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 7]);
00330     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 8]);
00331     EXPECT_EQ (hed_1, mesh.getHalfEdgeDataCloud () [ 9]);
00332     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [10]);
00333     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [11]);
00334     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [12]);
00335     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [13]);
00336 
00337     EXPECT_EQ (fd_0, mesh.getFaceDataCloud () [0]);
00338     EXPECT_EQ (fd_1, mesh.getFaceDataCloud () [1]);
00339     EXPECT_EQ (fd_2, mesh.getFaceDataCloud () [2]);
00340 
00341     mesh.deleteFace (FaceIndex (1));
00342     mesh.cleanUp ();
00343 
00344     checkSizeElements (mesh, 4,     5, 2);
00345     checkSizeData     (mesh, 4, 10, 5, 2);
00346 
00347     EXPECT_EQ (vd_0, mesh.getVertexDataCloud () [0]);
00348     EXPECT_EQ (vd_1, mesh.getVertexDataCloud () [1]);
00349     EXPECT_EQ (vd_2, mesh.getVertexDataCloud () [2]);
00350     EXPECT_EQ (vd_4, mesh.getVertexDataCloud () [3]);
00351 
00352     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [0]);
00353     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [1]);
00354     EXPECT_EQ (ed_0, mesh.getEdgeDataCloud () [2]);
00355     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [3]);
00356     EXPECT_EQ (ed_2, mesh.getEdgeDataCloud () [4]);
00357 
00358     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [0]);
00359     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [1]);
00360     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [2]);
00361     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [3]);
00362     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [4]);
00363     EXPECT_EQ (hed_0, mesh.getHalfEdgeDataCloud () [5]);
00364     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [6]);
00365     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [7]);
00366     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [8]);
00367     EXPECT_EQ (hed_2, mesh.getHalfEdgeDataCloud () [9]);
00368 
00369     EXPECT_EQ (fd_0, mesh.getFaceDataCloud () [0]);
00370     EXPECT_EQ (fd_2, mesh.getFaceDataCloud () [1]);
00371 
00372     // Change the stored data.
00373     MeshAD::VertexDataCloud   vdc;
00374     MeshAD::HalfEdgeDataCloud hedc;
00375     MeshAD::EdgeDataCloud     edc;
00376     MeshAD::FaceDataCloud     fdc;
00377     vdc.push_back  (100);
00378     hedc.push_back (200);
00379     edc.push_back  (300);
00380     fdc.push_back  (400);
00381 
00382     // Wrong size
00383     EXPECT_FALSE (mesh.setVertexDataCloud   (vdc));
00384     EXPECT_FALSE (mesh.setHalfEdgeDataCloud (hedc));
00385     EXPECT_FALSE (mesh.setEdgeDataCloud     (edc));
00386     EXPECT_FALSE (mesh.setFaceDataCloud     (fdc));
00387 
00388     // Correct size
00389     for (unsigned int i=1; i< 4; ++i) vdc.push_back  (100+i);
00390     for (unsigned int i=1; i<10; ++i) hedc.push_back (200+i);
00391     for (unsigned int i=1; i< 5; ++i) edc.push_back  (300+i);
00392     for (unsigned int i=1; i< 2; ++i) fdc.push_back  (400+i);
00393 
00394     EXPECT_TRUE (mesh.setVertexDataCloud   (vdc));
00395     EXPECT_TRUE (mesh.setHalfEdgeDataCloud (hedc));
00396     EXPECT_TRUE (mesh.setEdgeDataCloud     (edc));
00397     EXPECT_TRUE (mesh.setFaceDataCloud     (fdc));
00398 
00399     MeshAD::VertexDataCloud&   vdc_new  = mesh.getVertexDataCloud ();
00400     MeshAD::HalfEdgeDataCloud& hedc_new = mesh.getHalfEdgeDataCloud ();
00401     MeshAD::EdgeDataCloud&     edc_new  = mesh.getEdgeDataCloud ();
00402     MeshAD::FaceDataCloud&     fdc_new  = mesh.getFaceDataCloud ();
00403 
00404     EXPECT_EQ (vdc.size () , vdc_new.size ());
00405     EXPECT_EQ (hedc.size (), hedc_new.size ());
00406     EXPECT_EQ (edc.size () , edc_new.size ());
00407     EXPECT_EQ (fdc.size () , fdc_new.size ());
00408 
00409     for (unsigned int i=0; i<vdc_new.size  (); ++i) EXPECT_EQ (vdc  [i], vdc_new  [i]) << "Index " << i;
00410     for (unsigned int i=0; i<hedc_new.size (); ++i) EXPECT_EQ (hedc [i], hedc_new [i]) << "Index " << i;
00411     for (unsigned int i=0; i<edc_new.size  (); ++i) EXPECT_EQ (edc  [i], edc_new  [i]) << "Index " << i;
00412     for (unsigned int i=0; i<fdc_new.size  (); ++i) EXPECT_EQ (fdc  [i], fdc_new  [i]) << "Index " << i;
00413 
00414     vdc_new  [0] = 0;
00415     hedc_new [0] = 1;
00416     edc_new  [0] = 2;
00417     fdc_new  [0] = 3;
00418 
00419     EXPECT_EQ (0, mesh.getVertexDataCloud   () [0]);
00420     EXPECT_EQ (1, mesh.getHalfEdgeDataCloud () [0]);
00421     EXPECT_EQ (2, mesh.getEdgeDataCloud     () [0]);
00422     EXPECT_EQ (3, mesh.getFaceDataCloud     () [0]);
00423   }
00424 }
00425 
00427 
00428 int
00429 main (int argc, char** argv)
00430 {
00431   testing::InitGoogleTest (&argc, argv);
00432   return (RUN_ALL_TESTS ());
00433 }


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:35:08