⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delaunayview.h

📁 daunay三角网格生成 相当好的一个算法
💻 H
字号:
// DelaunayView.h : interface of the CDelaunayView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_DELAUNAYVIEW_H__8BFDEC2F_B5F7_11D3_AB59_080039014899__INCLUDED_)
#define AFX_DELAUNAYVIEW_H__8BFDEC2F_B5F7_11D3_AB59_080039014899__INCLUDED_

#include<gl\gl.h>
#include<gl\glu.h>
#include<gl\glaux.h>
#include "Triangle.h"	// Added by ClassView
#include "LightMaterial.h"
#include "Lighting.h"

typedef struct
{
	int a;
	int b;
	int c;
} array;

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CDelaunayView : public CView
{
protected: // create from serialization only
	CDelaunayView();
	DECLARE_DYNCREATE(CDelaunayView)

// Attributes
public:
	CDelaunayDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDelaunayView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	//}}AFX_VIRTUAL

// Implementation
////////////////////////////////////////////
public:
	double b[4][4][4];
	double Bezier(POI p);
	double Power(double a,int e);
	int Factorial(int n);
	double S(POI p1,POI p2,POI p3);
	POI GetTriNormal(POI p1,POI p2,POI p3);
	POI PointOnEdge_3(double x1, double y1, double x2, double y2);
	POI BaryCenter(double x1, double y1,double z1,double x2, double y2,double z2,double x3, double y3,double z3);
	void HCT(CTriangle* temp,int p);
	void CreateMaterial();
	void CreateLights();
	void DrawPoints();
	void DrawTris();
	void DrawPoint(int i);
	BOOL bSetupPixelFormat();
	void InitOpenGl();
	void DrawScene(void);
	int DelTriList(double x,double y,int p);
	void DrawTri(CTriangle *tri);
	array Wher(CPointPos *pos);
	int m_len;int m_oy;int m_ox;//坐标变换用
	int m_Dimension;//画2维或3维
	int m_HCT;//是否细分
	POI m_hct[10];
	int m_Draw_what;//画Line or Fill or Wang
//OpenGl/////////////////////////////////////
	//HGLRC hglrc;
	CClientDC *m_pDC;
	CRect m_oldRect;

	double m_translate_x;double m_translate_y;double m_translate_z;
	double m_rotate_angle;
	double m_gl_x;POI eye;
	double m_gl_y;
	double m_gl_z;

	float m_colorRed;
	float m_colorGreen;
	float m_colorBlue;
    BOOL m_bMaskRed;
	BOOL m_bMaskGreen;
	BOOL m_bMaskBlue;
    GLfloat m_materialAmb[4];
	GLfloat m_materialDif[4];
	GLfloat m_materialSpe[4];
    GLfloat m_materialEmi[4];
	GLfloat m_matshininess;
	BOOL m_bMaterial;

	GLfloat m_lightAmb[4];
	GLfloat m_lightDif[4];
	GLfloat m_lightSpe[4];
	GLfloat m_lightPos[4];
//OpenGl/////////////////////////////////////

	CDelaunayDoc* m_pDoc;
	//CMainFrame* m_MainFrame;
////////////////////////////////////////////
	virtual ~CDelaunayView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CDelaunayView)
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnDestroy();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnCorlorMaterial();
	afx_msg void OnUpdateCorlorMaterial(CCmdUI* pCmdUI);
	afx_msg void OnUpdateLight(CCmdUI* pCmdUI);
	afx_msg void OnLight();
	afx_msg void OnButtonTwo();
	afx_msg void OnUpdateButtonTwo(CCmdUI* pCmdUI);
	afx_msg void OnButtonThree();
	afx_msg void OnUpdateButtonThree(CCmdUI* pCmdUI);
	afx_msg void OnButtonHct();
	afx_msg void OnUpdateButtonHct(CCmdUI* pCmdUI);
	afx_msg void OnButtonFill();
	afx_msg void OnUpdateButtonFill(CCmdUI* pCmdUI);
	afx_msg void OnButtonLine();
	afx_msg void OnUpdateButtonLine(CCmdUI* pCmdUI);
	afx_msg void OnButtonWnag();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in DelaunayView.cpp
inline CDelaunayDoc* CDelaunayView::GetDocument()
   { return (CDelaunayDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DELAUNAYVIEW_H__8BFDEC2F_B5F7_11D3_AB59_080039014899__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -