Panda3D
 All Classes Functions Variables Enumerations
eggMesherEdge.h
00001 // Filename: eggMesherEdge.h
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 #ifndef EGGMESHEREDGE_H
00016 #define EGGMESHEREDGE_H
00017 
00018 #include "pandabase.h"
00019 #include "eggVertexPool.h"
00020 #include "eggVertex.h"
00021 #include "plist.h"
00022 
00023 class EggMesherStrip;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : EggMesherEdge
00027 // Description : Represents one edge of a triangle, as used by the
00028 //               EggMesher to discover connected triangles.  The edge
00029 //               is actually represented as a pair of vertex indices
00030 //               into the same vertex pool.
00031 ////////////////////////////////////////////////////////////////////
00032 class EggMesherEdge {
00033 public:
00034   INLINE EggMesherEdge(int vi_a, int vi_b);
00035   INLINE EggMesherEdge(const EggMesherEdge &copy);
00036 
00037   void remove(EggMesherStrip *strip);
00038   void change_strip(EggMesherStrip *from, EggMesherStrip *to);
00039 
00040   INLINE bool contains_vertex(int vi) const;
00041 
00042   INLINE bool matches(const EggMesherEdge &other) const;
00043 
00044   INLINE EggMesherEdge *common_ptr();
00045 
00046   INLINE bool operator == (const EggMesherEdge &other) const;
00047   INLINE bool operator != (const EggMesherEdge &other) const;
00048   INLINE bool operator < (const EggMesherEdge &other) const;
00049 
00050   INLINE double compute_length(const EggVertexPool *vertex_pool) const;
00051   INLINE LVecBase3d compute_box(const EggVertexPool *vertex_pool) const;
00052 
00053   void output(ostream &out) const;
00054 
00055   int _vi_a, _vi_b;
00056 
00057   typedef plist<EggMesherStrip *> Strips;
00058   Strips _strips;
00059   EggMesherEdge *_opposite;
00060 };
00061 
00062 INLINE ostream &
00063 operator << (ostream &out, const EggMesherEdge &edge) {
00064   edge.output(out);
00065   return out;
00066 }
00067 
00068 #include "eggMesherEdge.I"
00069 
00070 #endif
 All Classes Functions Variables Enumerations