实验二 区域填充算法
运行环境
配置和工程文件下载地址:
点击下载实验工程
Windows10
visual studio 2017
配置32和64位 OpenGl环境
实验代码
// 实验二 7个点的区域填充.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#define GLUT_DISABLE_ATEXIT_HACK
#pragma comment(lib, "Ws2_32.lib")
#include <cmath>
#include <cstdlib>
#include <gl/glut.h>
#include <windows.h>
const int POINTNUM = 7;
typedef struct XET
{
float x;
float dx, ymax;
XET* next;
}AET, NET;
struct point
{
float x;
float y;
}
polypoint[POINTNUM] = { 250,50,550,150,550,400,250,250,100,350,100,100,120,30 };
void PolyScan()
{
int MaxY = 0;
int i;
for (i = 0; i<POINTNUM; i++)
if (polypoint[i].y>MaxY)
MaxY = polypoint[i].y;
AET *pAET = new AET;
pAET->next = NULL;
NET *pNET[10