00001 //## begin module%374321B3005F.cm preserve=no 00002 // %X% %Q% %Z% %W% 00003 //## end module%374321B3005F.cm 00004 00005 //## begin module%374321B3005F.cp preserve=no 00006 //## end module%374321B3005F.cp 00007 00008 //## Module: Facet%374321B3005F; Pseudo Package body 00009 //## Source file: C:\project\mpk\code\geometry\Facet.cpp 00010 00011 //## begin module%374321B3005F.additionalIncludes preserve=no 00012 //## end module%374321B3005F.additionalIncludes 00013 00014 //## begin module%374321B3005F.includes preserve=yes 00015 #include <additional\streams\mystreams.h> 00016 #include <assert.h> 00017 //## end module%374321B3005F.includes 00018 00019 // Facet 00020 #include "geometry\Facet.h" 00021 //## begin module%374321B3005F.additionalDeclarations preserve=yes 00022 //## end module%374321B3005F.additionalDeclarations 00023 00024 00025 // Class Facet 00026 00027 00028 00029 00030 Facet::Facet (const unsigned int v1, const unsigned int v2, const unsigned int v3) 00031 //## begin Facet::Facet%927157749.hasinit preserve=no 00032 //## end Facet::Facet%927157749.hasinit 00033 //## begin Facet::Facet%927157749.initialization preserve=yes 00034 :direction( 1 ) 00035 //## end Facet::Facet%927157749.initialization 00036 { 00037 //## begin Facet::Facet%927157749.body preserve=yes 00038 vertexNumbers.push_back( v1 ) ; 00039 vertexNumbers.push_back( v2 ) ; 00040 vertexNumbers.push_back( v3 ) ; 00041 //## end Facet::Facet%927157749.body 00042 } 00043 00044 Facet::Facet () 00045 //## begin Facet::Facet%927307378.hasinit preserve=no 00046 //## end Facet::Facet%927307378.hasinit 00047 //## begin Facet::Facet%927307378.initialization preserve=yes 00048 //## end Facet::Facet%927307378.initialization 00049 { 00050 //## begin Facet::Facet%927307378.body preserve=yes 00051 //## end Facet::Facet%927307378.body 00052 } 00053 00054 00055 Facet::~Facet() 00056 { 00057 //## begin Facet::~Facet%.body preserve=yes 00058 vertexNumbers.clear() ; 00059 //## end Facet::~Facet%.body 00060 } 00061 00062 00063 00064 //## Other Operations (implementation) 00065 bool Facet::operator < (const Facet& right) const 00066 { 00067 //## begin Facet::operator<%945198433.body preserve=yes 00068 assert( false ) ; 00069 return false ; 00070 //## end Facet::operator<%945198433.body 00071 } 00072 00073 bool Facet::operator == (const Facet& right) const 00074 { 00075 //## begin Facet::operator==%945198434.body preserve=yes 00076 assert( false ) ; 00077 return false ; 00078 //## end Facet::operator==%945198434.body 00079 } 00080 00081 Facet& Facet::operator = (const Facet& right) 00082 { 00083 //## begin Facet::operator=%971655313.body preserve=yes 00084 assert( false ); 00085 return *this; 00086 //## end Facet::operator=%971655313.body 00087 } 00088 00089 // Additional Declarations 00090 //## begin Facet%374321B3005F.declarations preserve=yes 00091 //----------------------------------------------------------------------------- 00092 std::ostream & operator<<( std::ostream &os, const Facet& v ) 00093 { 00094 os << "[" ; 00095 for( int i = 0 ; i < v.vertexNumbers.size(); i++ ) 00096 { 00097 os << v.vertexNumbers[ i ] ; 00098 if( i != v.vertexNumbers.size() - 1 ) 00099 { 00100 os << "," ; 00101 } 00102 } 00103 os << "]" ; 00104 return os ; 00105 }; 00106 //----------------------------------------------------------------------------- 00107 std::istream & operator>>( std::istream &is, Facet& v ) 00108 { 00109 //check inputs 00110 assert( is.good() ) ; 00111 00112 //set the length of v to 0 00113 v.vertexNumbers.clear() ; 00114 00115 //read in numbers seperated by commas until we hit the ']' 00116 while( ( is.peek() != ']' ) && ( is.peek() != EOF ) ) 00117 { 00118 //remove the first character from the string 00119 char delimitingCharacter = 0 ; 00120 is >> delimitingCharacter ; 00121 00122 //read in the number from the string 00123 double number ; 00124 is >> number ; 00125 00126 //add the number to the vector 00127 v.vertexNumbers.push_back( number ) ; 00128 00129 //read the next character from the file 00130 } 00131 00132 //eat the last ']' 00133 if( is.peek() == ']' ) 00134 { 00135 is.get() ; 00136 } 00137 else 00138 { 00139 //IMPROVE: should throw an exception or something? 00140 } 00141 return is ; 00142 }; 00143 //----------------------------------------------------------------------------- 00144 00145 //## end Facet%374321B3005F.declarations 00146 //## begin module%374321B3005F.epilog preserve=yes 00147 //## end module%374321B3005F.epilog