Vertex.h

Go to the documentation of this file.
00001 
00005 #ifndef VERTEX_CM
00006 #define VERTEX_CM
00007 #include "Edge.h"
00008 
00011 class Vertex
00012 {
00013 private:
00014    const Vertex& operator=(const Vertex& rhs){ return *this;}
00015 public:
00016 
00017    // pointers for mesh structure
00018    Edge * edge;
00019 
00020    // geometry data
00021    Vector3 p;
00022    Vector3 uv;
00023 
00024    // Cone angle data (multiple of pi is stored)
00025    double min_cone_angle;
00026    double max_cone_angle;
00027    bool constrained;
00028    double cone_angle;
00029 
00030    // distinct id
00031    int ID;
00032    int patchID;
00033 
00034    // to check various iterations
00035    bool check;
00036 
00037    Vertex (const Vector3 & _pos = Vector3(0,0,0)): 
00038    edge(NULL), p(_pos), uv(0,0,0)
00039    {
00040       cone_angle = min_cone_angle = max_cone_angle = 2;
00041       constrained = false;
00042       patchID = 0;
00043    }
00044 
00045    // Assignment (copy only geometrical information)
00046    void assignData(const Vertex& rhs){
00047       if (this != &rhs) {
00048           p = rhs.p;
00049           uv = rhs.uv;
00050           cone_angle = rhs.cone_angle;
00051           min_cone_angle = rhs.min_cone_angle;
00052           max_cone_angle = rhs.max_cone_angle;
00053       }
00054    }
00055 
00056 
00057    bool isBoundary() {
00058       return (edge && !edge->face);
00059    }
00060 
00062   class EdgeAroundIterator {
00063    private:
00064       Edge * endI;
00065       Edge * run;
00066 
00067    public:
00068       EdgeAroundIterator(Edge * e) {
00069           endI = NULL;
00070           run = e;
00071       }
00072       EdgeAroundIterator& operator++( void ){
00073           if (!endI) endI = run;
00074           run = run->pair->next;
00075           return *this;
00076       }
00077       EdgeAroundIterator operator++( int ){
00078           EdgeAroundIterator r = *this; ++*this; return r;
00079       }
00080 
00081       Edge * edge_out( void ) const { return run; }
00082       Edge * & edge_out( void )     { return run; }
00083 
00084       Vertex * vertex( void ) const { return run->vertex; }
00085       Vertex * & vertex( void )     { return run->vertex; }
00086 
00087       bool end(void) { return endI == run;}
00088    };
00089 
00090    EdgeAroundIterator iterator() {return EdgeAroundIterator(edge);}
00091    EdgeAroundIterator iterator(Edge * eFrom) {return EdgeAroundIterator(eFrom);}
00092 
00093    int getValence() {
00094       Vertex::EdgeAroundIterator iter = iterator();
00095       int res = 0;
00096       for (; !iter.end(); iter++)
00097           res++;
00098       return res;
00099    }
00100 };
00101 #endif
00102 

Generated on Sat Jun 3 13:33:42 2006 for CirclePatterns by  doxygen 1.4.5