Subversion Repositories gelsvn

Rev

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

#ifndef __HMESH_VERTEXHANDLE_H__
#define __HMESH_VERTEXHANDLE_H__

#include "HMesh.h"

namespace CGLA
{ 
    // Forward declaration
    class Vec3f; 
}

namespace HMesh
{
    // Forward declarations
    class Manifold;
    class HalfEdgeHandle;
    struct Vertex;

    class VertexHandle
    {
    public:
        /// Constructor
        VertexHandle(Manifold& _m, Vidx _idx);

        /// Get a const Handle to outgoing halfedge
        const HalfEdgeHandle out() const;
        /// Get a Handle to outgoing halfedge
        HalfEdgeHandle out();

        /// Inspect vertex position
       // const CGLA::Vec3f& pos() const;
        /// Access the vertex position
       // CGLA::Vec3f& pos();

        const Vertex& get() const;
        Vertex& get();
        
        bool operator==(const VertexHandle& v) const;
        bool operator!=(const VertexHandle& v) const;

        void operator++();
        void operator++(int);
        void operator--();
        void operator--(int);

        bool is_valid() const;
        bool in_use() const;

        /// Get vertex index
        Vidx get_idx() const;
        /// Get manifold pointer 
    private:
        /// Vertex index
        Vidx idx;
        /// Pointer to manifold storing the vertex
        Manifold* m;
    };

    /// true if ID of halfedge != NULL_HALFEDGE
    //bool is_used(const VertexHandle& v);

    /// Returns true if the vertex is a boundary vertex.
    bool is_boundary(VertexHandle v);

    /// Compute valency, i.e. number of incident edges.
    uint valency(VertexHandle v);

    /// Compute the vertex normal. This function computes the angle weighted sum of incident face normals.
    CGLA::Vec3f normal(VertexHandle v);

    /// Returns true if the two argument vertices are in each other's one-rings.
    bool is_connected(VertexHandle v0, VertexHandle v1);

    /// Check and enforce boundary consistency.
    void check_boundary_consistency(VertexHandle v);
}

#endif __HMESH_VERTEXHANDLE_H__