polygon.h

来自「可以进行柱状图」· C头文件 代码 · 共 54 行

H
54
字号
// Polygon.h: interface for the CPolygon class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_POLYGON_H__57970DA8_69ED_4C58_9AFE_8A224CD41859__INCLUDED_)
#define AFX_POLYGON_H__57970DA8_69ED_4C58_9AFE_8A224CD41859__INCLUDED_

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

#include "Graph.h"
#include "Point.h"	// Added by ClassView

typedef struct Edge
{
   	int max;              //边的最大Y坐标
	float x;              //与当前扫描线的交点X坐标
	float dx;             //边所在直线斜率的倒数
	struct Edge *pNext;   //指向下一条边
}Edge,*LPEdge;


class CPolygon : public CGraph  
{
public:
	void CreateET();
	void SetPointNum(int n);
	int GetPointNum();

	void SETAELNULL(LPEdge node);
	void CreateAEL(LPEdge node);
	void Draw();

	void DrawCurrentscan(int currentscany);
	int GetProperX(LPEdge p);
	void DeleteAEL(int currentscany);
	void AddXInAEL();

	CPolygon();
	virtual ~CPolygon();

public:
	void Fill();
	int num;
	CPoint point[10];      //保存的是所画点的坐标
    LPEdge * pET;
	int miny,maxy;
	LPEdge AEL_head;      //活化边头结点

};

#endif // !defined(AFX_POLYGON_H__57970DA8_69ED_4C58_9AFE_8A224CD41859__INCLUDED_)

⌨️ 快捷键说明

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