shape_doc 0.1
|
00001 /***************************************************************************** 00002 * M a t h e m a g i x 00003 ***************************************************************************** 00004 * Edge 00005 * 2008-03-21 00006 * Julien Wintz 00007 ***************************************************************************** 00008 * Copyright (C) 2006 INRIA Sophia-Antipolis 00009 ***************************************************************************** 00010 * Comments : 00011 ****************************************************************************/ 00012 # ifndef shape_edge_hpp 00013 # define shape_edge_hpp 00014 00015 # include <shape/vertex.hpp> 00016 00017 # define TMPL template<class K> 00018 # define SELF edge<K> 00019 # undef Shape 00020 //==================================================================== 00021 namespace mmx { 00022 namespace shape { 00023 //==================================================================== 00024 // template<class K, class POINT> struct edge; 00025 00026 // struct edge_def {}; 00027 00028 // TMPL struct use<edge_def,K> { 00029 00030 // typedef edge<typename use<scalar_def,K>::Scalar, 00031 // typename use<point_def,K>::Point> Edge; 00032 // }; 00033 //-------------------------------------------------------------------- 00034 template<class C, class V= default_env, class POINT=point<C,V> > 00035 struct edge : public SHAPE_OF(V) 00036 { 00037 public: 00038 00039 typedef typename SHAPE_OF(V) Shape; 00040 typedef POINT Point; 00041 00042 edge(void) : Shape() {} 00043 edge(Point * source, Point * destination) : Shape() { 00044 this->m_source = source ; 00045 this->m_destination = destination ; 00046 } 00047 00048 inline Point * source(void) { return m_source ; } 00049 inline Point * destination(void) { return m_destination ; } 00050 inline void reverse() 00051 { Point *t=m_source; m_source=m_destination; m_destination=t; } 00052 00053 00054 private: 00055 Point * m_source ; 00056 Point * m_destination ; 00057 }; 00058 00059 //==================================================================== 00060 } ; // namespace shape 00061 } ; // namespace mmx 00062 //==================================================================== 00063 # undef TMPL 00064 # undef SELF 00065 # endif // shape_edge_hpp