www.pudn.com > VoronoiDAC.rar > Voronoi.h, change:2007-01-09,size:2287b
#ifndef _H_VORONOI
#define _H_VORONOI
#ifndef AFX_VORONOIDACDOC_H__67689E26_4CD7_417B_BA17_8DCEC0DFF8E1__INCLUDED_
#endif
#include "Shape.h"
#include "ConvexHull.h"
#include "MainFrm.h"
//#include "VoronoiDACDoc.h"
//const UINT WM_DRAWLINEMSG = ::RegisterWindowMessage(_T("DrawLineMsg"));
#define WM_DRAWLINEMSG (WM_USER + 101)
struct site;
struct half_edge;
struct face;
struct vertex;
struct MyPoint;
struct newline;
//class CVoronoiDACDoc;
//class CLine;
struct half_edge
{
vertex * pOriginVertex;
half_edge * next;
half_edge * previous;
half_edge * twin;
face * pLeftFace;
bool bVisited;//标记有没有被访问过.
};
struct face
{
half_edge * pStartHalfEdge;
half_edge * pEndHalfEdge;
site * pSite;
int iType;//0:表示正常,1表示异常.注意了.
face()
{
pEndHalfEdge = NULL;
pStartHalfEdge = NULL;
iType = 0;
}
};
struct vertex
{
double x;
double y;
// half_edge * pHalfEdge;
};
struct MyPoint
{
double x;
double y;
};
struct newline
{
MyPoint StartPoint;
MyPoint Direction;
int itype;// 0:直线 1:射线 2: 线段.
};
struct MessageStruct
{
int iActionType;// 1: 普通 2:闪烁 3: 动态(绿色,定) 4: 裁剪
int iSide; //1 左边 2:右边
double x1;
double y1;
double x2;
double y2;
};
class voronoi :public CWnd
{
private :
half_edge * m_pStartHalfEdge;
convex * pConvex;
public: int m_iType;
CMainFrame * m_pMF ;//= (CMainFrame *)(AfxGetApp()->m_pMainWnd);
CView * m_pActiveView;// = pMF->GetActiveView();
private:
MessageStruct m_Message;
//iType为1表示不正常,为0表示正常.
public:
//构造函数
voronoi();
//在构造函数中重新new几个site,不要就指向参数site,参数的site可能在外面被delete掉.要尽量的松耦合
voronoi(site * pSite1 , site * pSite2 , site * pSite3);
voronoi(site * pSite1 , site * pSite2);
void Init();
//merge
void MergeWithRightVoronoi(voronoi * pRightVoronoi , voronoi * pResultVoronoi, CTypedPtrArray<CObArray, CLine*> *pDeleteLine);
void GetFirstCrossPoint_WithNewLine(newline * pline);
void PrintAll(CTypedPtrArray<CObArray, CLine*> * pvecLineArray);
void AddLineToArray(CLine *pNewLine, CTypedPtrArray<CObArray, CLine*> *pLineArray);
half_edge * GetFirstHalfEdge();
convex * GetConvex();
};
#endif