jumping_pos.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 * VCGLib                                                            o o     *
00003 * Visual and Computer Graphics Library                            o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2004                                                \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *   
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
00021 *                                                                           *
00022 ****************************************************************************/
00023 
00024 /****************************************************************************
00025 ****************************************************************************/
00026 
00027 
00028 #ifndef __VCG_JUMPING_FACE_POS
00029 #define __VCG_JUMPING_FACE_POS
00030 
00031 #include <assert.h>
00032 #include <vcg/simplex/face/pos.h>
00033 
00034 namespace vcg 
00035 {
00036         namespace face 
00037         {
00040 
00041                 template < class FACE_TYPE >
00042                 class JumpingPos : public Pos< FACE_TYPE >
00043                 {
00044                 public: // Typedefs
00045                         typedef                                         FACE_TYPE                                                               FaceType;
00046                         typedef                                         Pos<FaceType>                                           PosType;
00047                         typedef                                         JumpingPos<FaceType>            JumpingPosType;
00048                         typedef typename        FaceType::VertexType            VertexType;
00049                         typedef typename        VertexType::CoordType           CoordType;
00050                         typedef typename        VertexType::ScalarType  ScalarType;
00051                         using Pos<FACE_TYPE>::f;
00052                         using Pos<FACE_TYPE>::z;
00053                         using Pos<FACE_TYPE>::FFlip;
00054                 public:
00055                         // Constructors
00056                         JumpingPos()                                                                                                                                                                                                                                                            : Pos<FACE_TYPE>()                                                              { }
00057                         JumpingPos(FaceType * const pFace, int const z, VertexType * const pVertex) : Pos<FACE_TYPE>(pFace, z, pVertex) {   }
00058                         JumpingPos(FaceType * const pFace, int const z)                                                                                                                 : Pos<FACE_TYPE>(pFace, z)                                              {  }
00059                         JumpingPos(FaceType * const pFace, VertexType * const pVertex)                                                  : Pos<FACE_TYPE>(pFace, pVertex)                        {  }
00060 
00062       bool FindBorder()
00063                         {
00064                                 PosType startPos=*this;
00065                                 do
00066                                 {
00067                                         if(f==FFlip() ) {
00068                                         PosType::FlipE();
00069                                         return true; // we are on a border
00070                                         }
00071                                         PosType::FlipF();
00072                                         PosType::FlipE();
00073                                 } while(*this != startPos);
00074                                 
00075                                 return false;
00076                         }
00077                         
00089                         bool NextFE()
00090                         {
00091                                 if ( f==FFlip() ) // we are on a border
00092                                 {
00093                                         do {
00094                                         PosType::FlipF();
00095                                         PosType::FlipE();
00096                                         } while (f!=FFlip());
00097                                         PosType::FlipE();
00098                                         return false;
00099                                 }
00100                                 else
00101                                 {
00102                                         PosType::FlipF();
00103                                         PosType::FlipE();
00104                                         return true;
00105                                 }
00106                         }
00107                 };
00108 
00110         } // end of namespace face
00111 } // end of namespace vcg
00112 
00113 #endif // __VCG_JUMPING_FACE_POS


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:32:31