Panda3D
 All Classes Functions Variables Enumerations
eggMesherEdge.h
1 // Filename: eggMesherEdge.h
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 #ifndef EGGMESHEREDGE_H
16 #define EGGMESHEREDGE_H
17 
18 #include "pandabase.h"
19 #include "eggVertexPool.h"
20 #include "eggVertex.h"
21 #include "plist.h"
22 
23 class EggMesherStrip;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : EggMesherEdge
27 // Description : Represents one edge of a triangle, as used by the
28 // EggMesher to discover connected triangles. The edge
29 // is actually represented as a pair of vertex indices
30 // into the same vertex pool.
31 ////////////////////////////////////////////////////////////////////
33 public:
34  INLINE EggMesherEdge(int vi_a, int vi_b);
35  INLINE EggMesherEdge(const EggMesherEdge &copy);
36 
37  void remove(EggMesherStrip *strip);
39 
40  INLINE bool contains_vertex(int vi) const;
41 
42  INLINE bool matches(const EggMesherEdge &other) const;
43 
44  INLINE EggMesherEdge *common_ptr();
45 
46  INLINE bool operator == (const EggMesherEdge &other) const;
47  INLINE bool operator != (const EggMesherEdge &other) const;
48  INLINE bool operator < (const EggMesherEdge &other) const;
49 
50  INLINE double compute_length(const EggVertexPool *vertex_pool) const;
51  INLINE LVecBase3d compute_box(const EggVertexPool *vertex_pool) const;
52 
53  void output(ostream &out) const;
54 
55  int _vi_a, _vi_b;
56 
58  Strips _strips;
59  EggMesherEdge *_opposite;
60 };
61 
62 INLINE ostream &
63 operator << (ostream &out, const EggMesherEdge &edge) {
64  edge.output(out);
65  return out;
66 }
67 
68 #include "eggMesherEdge.I"
69 
70 #endif
EggMesherEdge(int vi_a, int vi_b)
Defines an edge as a pair of vertices.
Definition: eggMesherEdge.I:23
double compute_length(const EggVertexPool *vertex_pool) const
Returns the length of the edge in model units.
bool contains_vertex(int vi) const
Returns true if the edge contains the indicated vertex index, false otherwise.
Definition: eggMesherEdge.I:48
bool matches(const EggMesherEdge &other) const
Returns true if this edge represents the same line segment as the other edge, in either direction...
Definition: eggMesherEdge.I:59
EggMesherEdge * common_ptr()
Returns an arbitrary pointer that is used to represent both this edge and its opposite.
Definition: eggMesherEdge.I:73
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:1455
Represents one edge of a triangle, as used by the EggMesher to discover connected triangles...
Definition: eggMesherEdge.h:32
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;.
bool operator<(const EggMesherEdge &other) const
Defines an arbitrary ordering for edges, used for putting edges in a sorted container.
void output(ostream &out) const
Formats the edge for output in some sensible way.
A collection of vertices.
Definition: eggVertexPool.h:46
LVecBase3d compute_box(const EggVertexPool *vertex_pool) const
Returns a 3-component vector that represents the lengths of the sides of the smalled axis-aligned box...