Subversion Repositories gelsvn

Rev

Rev 489 | Blame | Last modification | View Log | RSS feed

#ifndef __HMESH_VERTEXCIRCULATOR_H__
#define __HMESH_VERTEXCIRCULATOR_H__

#include "HalfEdgeHandle.h"

namespace HMesh
{
    // forward declaration
    class VertexHandle;
    class ConstVertexHandle;
    class FaceHandle;
    class ConstFaceHandle;

    class VertexCirculator
    {
    public:
        /// Construct circulator from vertex handle
        VertexCirculator(VertexHandle v);
        /// Construct circulator from halfedge handle
        VertexCirculator(HalfEdgeHandle h);

        /// Get current halfedge
            HalfEdgeHandle halfedge();
        /// Get opposite halfedge of the current halfedge, i.e. the one pointing towards us.
                HalfEdgeHandle opp_halfedge();
        /// Get vertex pointed to by current halfedge
        VertexHandle vertex();
        /// Get the face of the current halfedge.
                FaceHandle face();

        /// Prefix increment
        void operator++();
        /// Postfix increment
        void operator++(int);

        /// Has circulator come full circle?
                bool end();

        /// Number of steps = valency.
                IndexType no_steps();
    private:
        /// The last halfedge in circle
        HalfEdgeHandle last;
        /// Current halfedge in circle
        HalfEdgeHandle he;
        /// Steps taken in circle
        IndexType steps;
    };

    class ConstVertexCirculator
    {
    public:
        /// Construct circulator from vertex handle
        ConstVertexCirculator(ConstVertexHandle v);
        /// Construct circulator from halfedge handle
        ConstVertexCirculator(ConstHalfEdgeHandle h);

        /// Get current halfedge
            ConstHalfEdgeHandle halfedge() const;
        /// Get opposite halfedge of the current halfedge, i.e. the one pointing towards us.
                ConstHalfEdgeHandle opp_halfedge() const;
        /// Get vertex pointed to by current halfedge
        ConstVertexHandle vertex() const;
        /// Get the face of the current halfedge.
                ConstFaceHandle face() const;

        /// Prefix increment
        void operator++();
        /// Postfix increment
        void operator++(int);

        /// Has circulator come full circle?
                bool end();

        /// Number of steps = valency.
                IndexType no_steps();
    private:
        /// The last halfedge in circle
        ConstHalfEdgeHandle last;
        /// Current halfedge in circle
        ConstHalfEdgeHandle he;
        /// Steps taken in circle
        IndexType steps;
    };
}

#endif __HMESH_VERTEXCIRCULATOR_H__