From 9b7d4fc3592c1f0f9fb3dc6007ad42b9f51bc27a Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Wed, 16 May 2007 15:13:54 +0000 Subject: [PATCH] Initial commit --- vcg/simplex/face/jumping_pos.h | 94 ++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 vcg/simplex/face/jumping_pos.h diff --git a/vcg/simplex/face/jumping_pos.h b/vcg/simplex/face/jumping_pos.h new file mode 100644 index 00000000..d8ff534d --- /dev/null +++ b/vcg/simplex/face/jumping_pos.h @@ -0,0 +1,94 @@ +/**************************************************************************** +* VCGLib o o * +* Visual and Computer Graphics Library o o * +* _ O _ * +* Copyright(C) 2004 \/)\/ * +* Visual Computing Lab /\/| * +* ISTI - Italian National Research Council | * +* \ * +* All rights reserved. * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * +* for more details. * +* * +****************************************************************************/ + +/**************************************************************************** +****************************************************************************/ + + +#ifndef __VCG_JUMPING_FACE_POS +#define __VCG_JUMPING_FACE_POS + +#include +#include + +namespace vcg +{ + namespace face + { + /** \addtogroup face */ + /*@{*/ + + template < class FACE_TYPE > + class JumpingPos : public Pos< FACE_TYPE > + { + public: // Typedefs + typedef FACE_TYPE FaceType; + typedef Pos PosType; + typedef JumpingPos JumpingPosType; + typedef typename FaceType::VertexType VertexType; + typedef typename VertexType::CoordType CoordType; + typedef typename VertexType::ScalarType ScalarType; + + public: + // Constructors + JumpingPos() : Pos() { m_AlreadyJumped = false; } + JumpingPos(FaceType * const pFace, int const z, VertexType * const pVertex) : Pos(pFace, z, pVertex) { m_AlreadyJumped = false; } + JumpingPos(FaceType * const pFace, int const z) : Pos(pFace, z) { m_AlreadyJumped = false; } + JumpingPos(FaceType * const pFace, VertexType * const pVertex) : Pos(pFace, pVertex) { m_AlreadyJumped = false; } + + + /*! + * Returns the next edge skipping the border + * _________ + * /\ c | b /\ + * / \ | / \ + * / d \ | / a \ + * /______\|/______\ + * v + * In this example, if a and d are of-border and the pos is iterating counterclockwise, this method iterate through the faces incident on vertex v, + * producing the sequence a, b, c, d, a. + */ + void NextE() + { + if (face::IsBorder(*f,z) && !m_AlreadyJumped) + { + do PosType::NextE(); + while (f!=FFlip()); + m_AlreadyJumped = true; + } + else + { + PosType::NextE(); + m_AlreadyJumped = false; + } + } + + protected: + bool m_AlreadyJumped; + }; + + /*@}*/ + } // end of namespace face +} // end of namespace vcg + +#endif // __VCG_JUMPING_FACE_POS \ No newline at end of file