vtf-logo

shells/subdiv/Edge.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00004 //
00005 //                                   Fehmi Cirak   
00006 //                       California Institute of Technology
00007 //                          (C) 2003 All Rights Reserved
00008 //
00009 // <LicenseText>
00010 //
00011 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00012 //
00013 #ifndef __Edge_h__
00014 #define __Edge_h__
00015 
00016 #include <functional>
00017 
00018 #include "definitions.h"
00019 
00020 
00021 
00022 namespace subdiv {
00023 
00024     template <typename T, typename V>
00025     class Edge {
00026     public:
00027         Edge(V* a, V* b):_m_a(a), _m_b(b){
00028             _m_t = NULL;
00029         }
00030         ~Edge(){}
00031 
00032         //interface
00033         V* first(){return _m_a;}
00034         V* second(){return _m_b;}
00035         T*& triangle(){return _m_t;}
00036         
00037         // Comparisson functor for edge sets
00038         struct edge_comp : public std::binary_function< Edge* ,  Edge* , bool> {
00039             edge_comp() {}
00040             bool operator()( Edge *e1,  Edge *e2 ) {
00041                 const V* m1 = std::min( e1->first(), e1->second() );
00042                 const V* m2 = std::min( e2->first(), e2->second() );
00043                 return ( m1 < m2 ) ||
00044                     ( ( m1 == m2 ) && 
00045                       (std::max(e1->first(),e1->second()) < std::max(e2->first(),e2->second())) );
00046             }
00047         };
00048         
00049     private:
00050         V      *_m_a;         // first vertex
00051         V      *_m_b;         // second vertex
00052         T      *_m_t;         // one of the neighbouring triangles
00053     };
00054  
00055 }
00056 
00057 #endif /* __Edge_h__ */

Generated on Fri Aug 24 13:00:24 2007 for SFC Thin-Shell Finite Element Solver by  doxygen 1.4.7