DelaunayDoc.h
Upload User: azhong891
Upload Date: 2013-06-04
Package Size: 197k
Code Size: 4k
Category:

GIS program

Development Platform:

Visual C++

  1. // DelaunayDoc.h : interface of the CDelaunayDoc class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_DELAUNAYDOC_H__8BFDEC2D_B5F7_11D3_AB59_080039014899__INCLUDED_)
  5. #define AFX_DELAUNAYDOC_H__8BFDEC2D_B5F7_11D3_AB59_080039014899__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. //***********************************//
  10. #include <afxtempl.h>
  11. #include "pointpos.h"
  12. #include "triangle.h"
  13. #include "border.h"
  14. #include<glgl.h>
  15. #include<glglu.h>
  16. #include<glglaux.h>
  17. //**************************//
  18. /******************************/
  19. enum DO_WHAT
  20. DO_ADD,
  21.     DO_INTERPOLATION,
  22. DO_DRAW2,
  23. DO_DRAW3,
  24. DO_HCT,
  25. DO_LINE,
  26. DO_FILL,
  27. DO_WANG,
  28. };
  29. /******************************/
  30. class CDelaunayDoc : public CDocument
  31. {
  32. protected: // create from serialization only
  33. CDelaunayDoc();
  34. DECLARE_DYNCREATE(CDelaunayDoc)
  35. // Attributes
  36. public:
  37. // Operations
  38. public:
  39. // Overrides
  40. // ClassWizard generated virtual function overrides
  41. //{{AFX_VIRTUAL(CDelaunayDoc)
  42. public:
  43. virtual BOOL OnNewDocument();
  44. virtual void Serialize(CArchive& ar);
  45. virtual void DeleteContents();
  46. //}}AFX_VIRTUAL
  47. // Implementation
  48. //******************************//
  49. public:
  50. void Wang();
  51. int Belong(double x, double y,CTriangle* tri);
  52. CTriangle* Belong(double x,double y);
  53. double Power(double a, int e);
  54. int Factorial(int n);
  55. double S(POI p1, POI p2, POI p3);
  56. double Bezier(double x, double y,int m_p1,int m_p2,CTriangle* tri);
  57. void DrawTri(int m_p1,int m_p2,CTriangle* tri);
  58. double F(CTriangle *temp, int i, int j);
  59. double D(CTriangle *temp, int i, int j);//沿边方向导:i to j
  60. CPointPos* GetChuiZu(double x,double y,CPointPos* p2,CPointPos* p3);
  61. double GetMold(CPointPos* p);
  62. void BaryCenter(CTriangle* temp);
  63. void Get_Fx_Fy_N(int p);
  64. double DotProduction(double x1,double y1,double z1,double x2,double y2,double z2);//内积
  65. POI Unitization(POI p);
  66. POI VectorProduct(double x1,double y1,double z1,double x2,double y2,double z2);//外积
  67. double GetDistance(CPointPos* p1,CPointPos* p2);
  68. POI GetTriNormal(CTriangle *temp);
  69. void FindRelativeTri(int p);
  70. bool DelEdgeOrNot(int p1,int p2,int p);
  71. int TheOtherPoint(int p1,int p2,CTriangle* temp);
  72. CPointPos* CDelaunayDoc::IntersectionPoint(CPointPos *point1, CPointPos *point2,CPointPos *point3, CPointPos *point4);
  73. void EditCon(int r,int l ,int p);
  74. void DelTriMarked();
  75. int GetInitEdges(double x,double y,int p);
  76. int TwoEdgeSuperposition(CBorder *b1, CBorder *b2);
  77. double S(int p1,int p2,int p3);
  78. double S(CPointPos *p1,CPointPos *p2,CPointPos *p3);
  79. void AddTriangle(int p);
  80. //int m_clen;//凸包边界的节点个数,it be replaced by 'm_con.GetSize()' now
  81. //int m_plen;//当前节点个数,it be replaced by 'm_point.GetSize()' now
  82. void Center(CTriangle* temp);
  83. DO_WHAT m_DoWhat;
  84. CTypedPtrArray<CObArray,CPointPos*> m_point;//存节点
  85.     //CTypedPtrArray<CObArray,CPointPos*> m_n;//存节点的法向量
  86. CTypedPtrList<CObList,CTriangle*> m_tri;//存三角链
  87. void AddPoint(double x,double y);
  88. CArray<POSITION,POSITION&> m_index;//指向三角形链的节点的指针数组,对将要删出的三角形做标志
  89. CTypedPtrArray<CObArray,CBorder*> m_edge;//Record the border of the inserted polygon
  90. CWordArray m_con;//存放凸包边界上所有节点的坐标数组下标(of m_point),逆时针
  91. //******************************//
  92. virtual ~CDelaunayDoc();
  93. #ifdef _DEBUG
  94. virtual void AssertValid() const;
  95. virtual void Dump(CDumpContext& dc) const;
  96. #endif
  97. protected:
  98. // Generated message map functions
  99. protected:
  100. //{{AFX_MSG(CDelaunayDoc)
  101. afx_msg void OnButtonAdd();
  102. afx_msg void OnUpdateButtonAdd(CCmdUI* pCmdUI);
  103. afx_msg void OnButtonBB();
  104. afx_msg void OnUpdateButtonBB(CCmdUI* pCmdUI);
  105. //}}AFX_MSG
  106. DECLARE_MESSAGE_MAP()
  107. };
  108. /////////////////////////////////////////////////////////////////////////////
  109. //{{AFX_INSERT_LOCATION}}
  110. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  111. #endif // !defined(AFX_DELAUNAYDOC_H__8BFDEC2D_B5F7_11D3_AB59_080039014899__INCLUDED_)