Edge.cpp

Go to the documentation of this file.
00001 /*
00002 **    Mesh Converter
00003 **    Copyright (C) 2008  Damien Rohmer
00004 **
00005 **    This program is free software: you can redistribute it and/or modify
00006 **    it under the terms of the GNU General Public License as published by
00007 **    the Free Software Foundation, either version 3 of the License, or
00008 **    (at your option) any later version.
00009 **
00010 **   This program is distributed in the hope that it will be useful,
00011 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 **    GNU General Public License for more details.
00014 **
00015 **    You should have received a copy of the GNU General Public License
00016 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 
00021 
00022 #include <Edge.h>
00023 
00024 
00025 
00026 Edge::Edge():
00027   index_0(-1),index_1(-1),face_01(-1),face_10(-1),next_edge(-1),previous_edge(-1),half_edge(-1)
00028 {}
00029 
00030 Edge::Edge(const Edge& e)
00031 {
00032   index_0       = e.index_0;
00033   index_1       = e.index_1;
00034   face_01       = e.face_01;
00035   face_10       = e.face_10;
00036   next_edge     = e.next_edge;
00037   previous_edge = e.previous_edge;
00038   half_edge     = e.half_edge;
00039 }
00040 Edge::~Edge(){destroy();}
00041 int Edge::destroy()
00042 {
00043   index_0=-1;
00044   index_1=-1;
00045   face_01=-1;
00046   face_10=-1;
00047   next_edge=-1;
00048   previous_edge=-1;
00049   half_edge=-1;
00050 
00051   return 0;
00052 }
00053 
00054 
00055 
00056 
00057 int Edge::set_index_0(int i0){index_0=i0;return 0;}
00058 int Edge::set_index_1(int i1){index_1=i1;return 0;}
00059 int Edge::set_index(int i0,int i1){index_0=i0;index_1=i1;return 0;}
00060 
00061 int Edge::set_face_0(int f0){face_01=f0;return 0;}
00062 int Edge::set_face_1(int f1){face_10=f1;return 0;}
00063 int Edge::set_face(int f0,int f1){face_01=f0;face_10=f1;return 0;}
00064 
00065 int Edge::set_next_edge(int e0){next_edge=e0;return 0;}
00066 int Edge::set_previous_edge(int e1){previous_edge=e1;return 0;}
00067 int Edge::set_edges(int e0,int e1){next_edge=e0;previous_edge=e1;return 0;}
00068 
00069 int Edge::set_half_edge(int e){half_edge=e;return 0;}
00070 
00071 
00072 
00073 
00074 int  Edge::get_index_0() const {return index_0;}
00075 int& Edge::get_index_0() {return index_0;}
00076 int  Edge::get_index_1() const {return index_1;}
00077 int& Edge::get_index_1() {return index_1;}
00078 
00079 int  Edge::get_face_0() const {return face_01;}
00080 int& Edge::get_face_0() {return face_01;}
00081 int  Edge::get_face_1() const {return face_10;}
00082 int& Edge::get_face_1() {return face_10;} 
00083 
00084 int  Edge::get_edge_0() const {return next_edge;}
00085 int& Edge::get_edge_0() {return next_edge;}
00086 int  Edge::get_edge_1() const {return previous_edge;}
00087 int& Edge::get_edge_1() {return previous_edge;}
00088 int  Edge::get_next_edge_index() const{return next_edge;}
00089 int& Edge::get_next_edge_index() {return next_edge;}
00090 int  Edge::get_previous_edge_index() const {return previous_edge;}
00091 int& Edge::get_previous_edge_index() {return previous_edge;}
00092 
00093 
00094 int  Edge::get_half_edge() const{return half_edge;}
00095 int& Edge::get_half_edge(){return half_edge;}
00096 
00097 
00098 const Edge& Edge::operator=(const Edge& e)
00099 {
00100   index_0       = e.index_0;
00101   index_1       = e.index_1;
00102   face_01       = e.face_01;
00103   face_10       = e.face_10;
00104   next_edge     = e.next_edge;
00105   previous_edge = e.previous_edge;
00106   half_edge     = e.half_edge;
00107 
00108   return *this;
00109 }
00110 
00111 bool operator==(const Edge& e1,const Edge& e2)
00112 {
00113   if(e1.index_0!=e2.index_0)
00114     return 0;
00115   if(e1.index_1!=e2.index_1)
00116     return 0;
00117   if(e1.face_01!=e2.face_01)
00118     return 0;
00119   if(e1.face_10!=e2.face_10)
00120     return 0;
00121   if(e1.next_edge!=e2.next_edge)
00122     return 0;
00123   if(e1.previous_edge!=e2.previous_edge)
00124     return 0;
00125   if(e1.half_edge!=e2.half_edge)
00126     return 0;
00127 
00128   return 1;
00129 }
00130 bool operator!=(const Edge& e1,const Edge& e2)
00131 {return !(e1==e2);}
00132 std::ostream& operator << (std::ostream& flux,const Edge& e)
00133 {
00134   flux<<"i ["<<e.index_0<<","<<e.index_1<<"] , f ["<<e.face_01<<","<<e.face_10<<"] , e ["<<e.next_edge<<","<<e.previous_edge<<"]"<<" h "<<e.half_edge;
00135   return flux;
00136 }
00137 
00138 

Generated on Mon Mar 30 16:55:54 2009 by  doxygen 1.5.6