Panda3D
|
00001 // Filename: eggMesherEdge.cxx 00002 // Created by: drose (13Mar05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "eggMesherEdge.h" 00016 #include "eggMesherStrip.h" 00017 00018 //////////////////////////////////////////////////////////////////// 00019 // Function: EggMesherEdge::remove 00020 // Access: Public 00021 // Description: Removes an edge from a particular strip. 00022 //////////////////////////////////////////////////////////////////// 00023 void EggMesherEdge:: 00024 remove(EggMesherStrip *strip) { 00025 strip->_edges.remove(this); 00026 strip->_edges.remove(_opposite); 00027 00028 _strips.remove(strip); 00029 _opposite->_strips.remove(strip); 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: EggMesherEdge::change_strip 00034 // Access: Public 00035 // Description: Reparents the edge from strip "from" to strip "to". 00036 //////////////////////////////////////////////////////////////////// 00037 void EggMesherEdge:: 00038 change_strip(EggMesherStrip *from, EggMesherStrip *to) { 00039 Strips::iterator si; 00040 00041 for (si = _strips.begin(); si != _strips.end(); ++si) { 00042 if (*si == from) { 00043 *si = to; 00044 } 00045 } 00046 00047 for (si = _opposite->_strips.begin(); 00048 si != _opposite->_strips.end(); 00049 ++si) { 00050 if (*si == from) { 00051 *si = to; 00052 } 00053 } 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: EggMesherEdge::output 00058 // Access: Public 00059 // Description: Formats the edge for output in some sensible way. 00060 //////////////////////////////////////////////////////////////////// 00061 void EggMesherEdge:: 00062 output(ostream &out) const { 00063 out << "Edge [" << _vi_a << " to " << _vi_b << "], " 00064 << _strips.size() << " strips:"; 00065 00066 Strips::const_iterator si; 00067 for (si = _strips.begin(); si != _strips.end(); ++si) { 00068 out << " " << (*si)->_index; 00069 } 00070 00071 if (_opposite!=NULL) { 00072 out << " opposite " 00073 << _opposite->_strips.size() << " strips:"; 00074 00075 for (si = _opposite->_strips.begin(); 00076 si != _opposite->_strips.end(); 00077 ++si) { 00078 out << " " << (*si)->_index; 00079 } 00080 } 00081 }