meshadj.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**********************************************************************
  2. *<
  3. FILE: meshadj.h
  4. DESCRIPTION: Adjacency list for meshes.
  5. CREATED BY: Rolf Berteig
  6. HISTORY:
  7. *> Copyright (c) 1994, All Rights Reserved.
  8. **********************************************************************/
  9. #ifndef __MESHADJ__
  10. #define __MESHADJ__
  11. #include "export.h"
  12. #define UNDEFINED 0xffffffff
  13. class MEdge {
  14. public:
  15. DWORD f[2];
  16. DWORD v[2];
  17. };
  18. class AdjEdgeList {
  19. public:
  20. DWORDTab *list; // 1 DWORDTab per vertex. The Tab is a list of indices into the edge list, 1 for each edge adjacent to the vertex
  21. Tab<MEdge> edges; // Table of edges
  22. int nverts; // size of 'list'.
  23. DllExport AdjEdgeList(Mesh& amesh);
  24. DllExport ~AdjEdgeList();
  25. AdjEdgeList& operator=(AdjEdgeList& a) {assert(0);return *this;}
  26. DllExport void AddEdge( DWORD fi, DWORD v1, DWORD v2 );
  27. DWORDTab& operator[](int i) { return list[i]; }
  28. DllExport int FindEdge(DWORD v0, DWORD v1);
  29. DllExport int FindEdge(DWORDTab& vmap,DWORD v0, DWORD v1);
  30. DllExport void TransferEdges(DWORD from,DWORD to,DWORD except1,DWORD except2,DWORD del);
  31. DllExport void RemoveEdge(DWORD from,DWORD e);
  32. };
  33. class AdjFace {
  34. public:
  35. DWORD f[3];
  36. AdjFace() {f[0] = f[1] = f[2] = UNDEFINED;}
  37. };
  38. class AdjFaceList {
  39. public:
  40. Tab<AdjFace> list;
  41. AdjFace& operator[](int i) {return list[i];}
  42. DllExport AdjFaceList(Mesh& mesh,AdjEdgeList& el);
  43. };
  44. class FaceElementList {
  45. public:
  46. // For each face, which element is it in
  47. DWORDTab elem;
  48. DWORD count;
  49. DllExport FaceElementList(Mesh &mesh,AdjFaceList& af);
  50. DWORD operator[](int i) {return elem[i];}
  51. };
  52. class FaceClusterList {
  53. public:
  54. // Cluster #, one for each face - non-selected faces have UNDEFINED for their id.
  55. DWORDTab clust;
  56. DWORD count;
  57. // This version separates cluster also using a minimum angle and optionally the selection set
  58. FaceClusterList(Mesh *mesh, AdjFaceList& adj,float angle,BOOL useSel=TRUE);
  59. // Uses selection set
  60. FaceClusterList(BitArray& fsel, AdjFaceList& adj);
  61. DWORD operator[](int i) { return clust[i]; }
  62. };
  63. #endif //__MESHADJ__