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

📄 lytgraphicsview.h

📁 draw 2D and 3D basic graph with visual C++!
💻 H
字号:
// LYTGraphicsView.h : interface of the CLYTGraphicsView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_LYTGRAPHICSVIEW_H__DC2CF5ED_C499_4CDD_99CB_A8654E4F2E49__INCLUDED_)
#define AFX_LYTGRAPHICSVIEW_H__DC2CF5ED_C499_4CDD_99CB_A8654E4F2E49__INCLUDED_
//添加对话框头文件
#include "LYTTWO1.h"
#include "LYTTWO2.h"
#include "LYTTWO3.h"
#include "LYTTHREE.h"

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

/*以下两个结构体是用于三维图形及其变换
存放三维图形以及二维图形点的坐标*/

typedef struct _tPoint3D
{
	double x;
	double y;
	double z;
}Point3D;

typedef struct _tPoint2D
{
	double x;
	double y;
}Point2D;

class CLYTGraphicsView : public CView
{
protected: // create from serialization only
	CLYTGraphicsView();
	DECLARE_DYNCREATE(CLYTGraphicsView)
    /*绘制b样条曲线用的参数*/
	CPoint p2[32];
	int m_PN;

// Attributes
public:
	CLYTGraphicsDoc* GetDocument();
/*以下是用于绘制bezier曲线的变量*/
	CPoint p[100],x0,xm;
	int n,k,h;
	bool flag,flag2;
/*以下是用于绘制基本图形的变量*/
int n1;
	CPoint p1[7];
	int s;
	bool flag1;
	CPoint yl,start,old,midpont;

	bool flag3;//b yangtiao
	/*以下是二维图形变换用到的变量*/
	bool flag4;
	POINT p44[3];
	LYTTWO1 dlg1;//定义对话框公有对象
	LYTTWO2 dlg2;
	LYTTWO3 dlg3;
	float p4[3][3],t[3][3],pm[3][3];//存放三角形的矩阵以及变换矩阵
	int n4,s4;
	/*以下是三维图形及其变换用到的变量*/
	bool flag5;//?
	int MaxX,MaxY;
	Point3D * point;
	double matrix[4][4];
	LYTTHREE * pdlg;
	int model;


// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CLYTGraphicsView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	void GetMaxX();
	void GetMaxY();
	Point3D * TranslatePoint(Point3D * pt,double matrix[4][4],const int & n);
	void DrawGraphics(const Point3D * pt,const int & n);
	void ClearMatrix();
	void Transform3DTo2D(Point2D * pt2d,const Point3D * pt3d,const int & n);
	void InitialMatrix();
	void MatrixMultiply(float a[][3],float b[][3]);
	CPoint b(int n,float t,CPoint p[]);
	float c(int n,int i,float t);

	virtual ~CLYTGraphicsView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	void parabola(CPen *poldPen,CPoint *pp,int n);
	//{{AFX_MSG(CLYTGraphicsView)
	afx_msg void OnDrawBezier();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnResult();
	afx_msg void OnClear();
	afx_msg void OnLine();
	afx_msg void OnRectangle();
	afx_msg void OnEllipse();
	afx_msg void OnDuobianxing();
	afx_msg void OnClear1();
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnDrawByt();
	afx_msg void OnScale();
	afx_msg void OnDrawAngle();
	afx_msg void OnScale1();
	afx_msg void OnXsymmetry();
	afx_msg void OnYsymmetry();
	afx_msg void OnOsymmetry();
	afx_msg void OnRotationOriginal();
	afx_msg void OnRotationAnypoint();
	afx_msg void OnShear();
	afx_msg void OnClearTwo();
	afx_msg void OnDrawCuboid();
	afx_msg void OnThreeTranslate();
	afx_msg void OnThreeScale();
	afx_msg void OnThreeRotation();
	afx_msg void OnThreeReflect();
	afx_msg void OnThreeTwist();
	afx_msg LRESULT OnTranslate(WPARAM wParam,LPARAM lParam);//手工处理消息映射
	afx_msg void OnThreeClear();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in LYTGraphicsView.cpp
inline CLYTGraphicsDoc* CLYTGraphicsView::GetDocument()
   { return (CLYTGraphicsDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_LYTGRAPHICSVIEW_H__DC2CF5ED_C499_4CDD_99CB_A8654E4F2E49__INCLUDED_)

⌨️ 快捷键说明

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