Subversion Repositories gelsvn

Rev

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

#ifndef __HMESH_MESHTYPES_H__
#define __HMESH_MESHTYPES_H__

#include <climits>
#include <CGLA/Vec3f.h>

namespace HMesh
{
    /** 
        Definitions of the indice types for vertices, halfedges and faces.
        Used to access and keep track of elements in manifold arrays.
    */
    typedef size_t HIDX;
    typedef size_t VIDX;
    typedef size_t FIDX;
    typedef int TOUCHTYPE;

    const VIDX NULL_VERTEX_IDX = UINT_MAX;
    const HIDX NULL_HALFEDGE_IDX = UINT_MAX; 
    const FIDX NULL_FACE_IDX = UINT_MAX;

    struct Vertex
    {
        /// Position of vertex
            CGLA::Vec3f pos;

        /// Index of outgoing halfedge
        HIDX out_idx;

        /// General purpose integer. Normally used as index or flag.
        TOUCHTYPE touched;

        /// Default Constructor
        Vertex() : 
            pos(CGLA::Vec3f(0)), 
            out_idx(NULL_HALFEDGE_IDX), 
            touched(0){}

        /// Constructor
        Vertex(const CGLA::Vec3f& _pos) : 
            pos(_pos), 
            out_idx(NULL_HALFEDGE_IDX), 
            touched(0){}
    };

    struct HalfEdge
    {
        /// Index of vertex pointed to
        VIDX vert_idx;
        /// Index of next halfedge in face loop
        HIDX next_idx;
        /// Index of previous halfedge in face loop
        HIDX prev_idx;
        /// Index of opposite halfedge
        HIDX opp_idx;
        /// Index of face owning this halfedge
        FIDX face_idx;

        /// General purpose integer. Normally used as index or flag.
        TOUCHTYPE touched;

        /// Constructor
        HalfEdge() :    
            vert_idx(NULL_VERTEX_IDX), 
                        next_idx(NULL_HALFEDGE_IDX), 
                        prev_idx(NULL_HALFEDGE_IDX),
                        opp_idx(NULL_HALFEDGE_IDX), 
                        face_idx(NULL_FACE_IDX),
            touched(0){}
    };

    struct Face
    {
        /// Index of some halfedge owned by this face
        HIDX last_idx;

        /// General purpose integer. Normally used as index or flag.
        TOUCHTYPE touched;
  
        /// Constructor
        Face() : 
            last_idx(NULL_HALFEDGE_IDX), 
            touched(0){}
    };
}

#endif

Generated by GNU Enscript 1.6.6.