文档介绍:
《计算机图形学实验》报告
2016年春季学期
实验六:扫描线填充算法
实验时间:
实验地点:
实验目的:掌握使用opengl 的扫描线填充算法,观察改变参数对生成图形的改变。
程序代码:
使用的运行环境是vs2010
#include "stdafx.h"
#include "glut.h"
#include "windows.h"
const int POINTNUM=3; //多边形点数.
/*****************************************/
typedef struct XET
{
float x;
float dx,ymax;
XET* next;
};
/******定义点结构体point******************************************************/
struct point
{
float x;
float y;
}
polypoint[POINTNUM]={250,50,550,150,550,400};//多边形顶点
void PolyScan()
{
/******计算最高点的y坐标(扫描到此结束)****************************************/
int MaxY=0;
int i;
for(i=0;i
if(polypoint[i