Panda3D
eggMesherEdge.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggMesherEdge.cxx
10  * @author drose
11  * @date 2005-03-13
12  */
13 
14 #include "eggMesherEdge.h"
15 #include "eggMesherStrip.h"
16 
17 /**
18  * Removes an edge from a particular strip.
19  */
20 void EggMesherEdge::
22  strip->_edges.remove(this);
23  strip->_edges.remove(_opposite);
24 
25  _strips.remove(strip);
26  _opposite->_strips.remove(strip);
27 }
28 
29 /**
30  * Reparents the edge from strip "from" to strip "to".
31  */
32 void EggMesherEdge::
34  Strips::iterator si;
35 
36  for (si = _strips.begin(); si != _strips.end(); ++si) {
37  if (*si == from) {
38  *si = to;
39  }
40  }
41 
42  for (si = _opposite->_strips.begin();
43  si != _opposite->_strips.end();
44  ++si) {
45  if (*si == from) {
46  *si = to;
47  }
48  }
49 }
50 
51 /**
52  * Formats the edge for output in some sensible way.
53  */
54 void EggMesherEdge::
55 output(std::ostream &out) const {
56  out << "Edge [" << _vi_a << " to " << _vi_b << "], "
57  << _strips.size() << " strips:";
58 
59  Strips::const_iterator si;
60  for (si = _strips.begin(); si != _strips.end(); ++si) {
61  out << " " << (*si)->_index;
62  }
63 
64  if (_opposite!=nullptr) {
65  out << " opposite "
66  << _opposite->_strips.size() << " strips:";
67 
68  for (si = _opposite->_strips.begin();
69  si != _opposite->_strips.end();
70  ++si) {
71  out << " " << (*si)->_index;
72  }
73  }
74 }
void remove(EggMesherStrip *strip)
Removes an edge from a particular strip.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void output(std::ostream &out) const
Formats the edge for output in some sensible way.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 "from" to strip "to".