Panda3D
 All Classes Functions Variables Enumerations
eggMesherEdge.cxx
1 // Filename: eggMesherEdge.cxx
2 // Created by: drose (13Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "eggMesherEdge.h"
16 #include "eggMesherStrip.h"
17 
18 ////////////////////////////////////////////////////////////////////
19 // Function: EggMesherEdge::remove
20 // Access: Public
21 // Description: Removes an edge from a particular strip.
22 ////////////////////////////////////////////////////////////////////
23 void EggMesherEdge::
25  strip->_edges.remove(this);
26  strip->_edges.remove(_opposite);
27 
28  _strips.remove(strip);
29  _opposite->_strips.remove(strip);
30 }
31 
32 ////////////////////////////////////////////////////////////////////
33 // Function: EggMesherEdge::change_strip
34 // Access: Public
35 // Description: Reparents the edge from strip "from" to strip "to".
36 ////////////////////////////////////////////////////////////////////
37 void EggMesherEdge::
39  Strips::iterator si;
40 
41  for (si = _strips.begin(); si != _strips.end(); ++si) {
42  if (*si == from) {
43  *si = to;
44  }
45  }
46 
47  for (si = _opposite->_strips.begin();
48  si != _opposite->_strips.end();
49  ++si) {
50  if (*si == from) {
51  *si = to;
52  }
53  }
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: EggMesherEdge::output
58 // Access: Public
59 // Description: Formats the edge for output in some sensible way.
60 ////////////////////////////////////////////////////////////////////
61 void EggMesherEdge::
62 output(ostream &out) const {
63  out << "Edge [" << _vi_a << " to " << _vi_b << "], "
64  << _strips.size() << " strips:";
65 
66  Strips::const_iterator si;
67  for (si = _strips.begin(); si != _strips.end(); ++si) {
68  out << " " << (*si)->_index;
69  }
70 
71  if (_opposite!=NULL) {
72  out << " opposite "
73  << _opposite->_strips.size() << " strips:";
74 
75  for (si = _opposite->_strips.begin();
76  si != _opposite->_strips.end();
77  ++si) {
78  out << " " << (*si)->_index;
79  }
80  }
81 }
void remove(EggMesherStrip *strip)
Removes an edge from a particular strip.
Represents a triangle strip or quad strip in progress, as assembled by the mesher.
void change_strip(EggMesherStrip *from, EggMesherStrip *to)
Reparents the edge from strip &quot;from&quot; to strip &quot;to&quot;.
void output(ostream &out) const
Formats the edge for output in some sensible way.