www.pudn.com > ZhuYouyong.rar > Graph.h


#define color RGB(0,0,0) 
#define WINDOW_HEIGH 645  //显示器的高度 
#define dingdian 50    //多边形填充的顶点个数 
#define jian 25       //箭头长度 
#define zuobiao 500       //坐标轴长度 
#define chad 300    //正方体长度 
 
typedef struct tEdge 
{ 
	int ymin; 
	float x,dx; 
	struct tEdge *next; 
}Edge; 
 
typedef struct tPoint3D 
{ 
	double x; 
	double y; 
	double z; 
}Point3D; 
 
class CGraph : public CClientDC 
{ 
public: 
	CGraph(CWnd *); 
	void DDAline(int x1,int y1,int x2,int y2); 
	void bresenhamline(int x1,int y1,int x2,int y2); 
	void bresenham_circle(int x,int y,int m,int n); 
    void oval(int x,int y,int m,int n); 
	void spline(int x,int y,int m,int n,int p,int q); 
	void areafill(int cnt,CPoint *pts);   
	void huatu(CPoint cao); 
    void Line3D(Point3D ps,Point3D pe,double D,double R,double theta,double phi); 
	CPoint PTrans(Point3D p3,double D,double R,double theta,double phi); 
	CPoint clip3dline(Point3D p1,Point3D p2,CPoint cao); 
	void draw3dline(CPoint cao); 
 
protected: 
    void buildedgelist(int cnt,CPoint *pts,Edge *edges[]);  //以下为多边形填充! 
	void insertedge(Edge *list,Edge *edge); 
	void buildactivelist(int scan,Edge *active,Edge *edges[]); 
	void fillscan(int scan,Edge *active); 
	void updateactivelist(int scan,Edge *active); 
};