没有合适的资源?快使用搜索试试~ 我知道了~
中点裁剪算法代码及穆淼文件
需积分: 9 5 下载量 166 浏览量
2011-04-28
08:45:45
上传
评论
收藏 4KB TXT 举报
温馨提示
试读
8页
计算机图形学问题:编写中点分割的线段裁剪算法?
资源推荐
资源详情
资源评论
#include <GL/glut.h>
#include <stdlib.h>
#include "iostream.h"
int x0,y0,x1,y1;
int Max(int a,int b,int c)
{
if(a>b)
{
if(a>c)
return a;
else
return c;
}
else
{
if(b>c)
return b;
else
return c;
}
}
int Min(int a,int b,int c)
{
if(a<b)
{
if(a<c)
return a;
else
#include <stdlib.h>
#include "iostream.h"
int x0,y0,x1,y1;
int Max(int a,int b,int c)
{
if(a>b)
{
if(a>c)
return a;
else
return c;
}
else
{
if(b>c)
return b;
else
return c;
}
}
int Min(int a,int b,int c)
{
if(a<b)
{
if(a<c)
return a;
else
return c;
}
else
{
if(b<c)
return b;
else
return c;
}
}
void DrawLine1(int x0,int y0,int x1,int y1)
{
int d,temp;
temp=y0;
d=2*(y1-y0)-(x1-x0);
glBegin(GL_POINTS);
glVertex2d(x0,y0);
glEnd();
for(int k=x0+1;k<x1;k++)
{
if(d>=0)
{
glBegin(GL_POINTS);
glVertex2d(k,temp+1);
glEnd();
d=d+2*(y1-y0)-2*(x1-x0);
temp=temp+1;
}
else
{
if(b<c)
return b;
else
return c;
}
}
void DrawLine1(int x0,int y0,int x1,int y1)
{
int d,temp;
temp=y0;
d=2*(y1-y0)-(x1-x0);
glBegin(GL_POINTS);
glVertex2d(x0,y0);
glEnd();
for(int k=x0+1;k<x1;k++)
{
if(d>=0)
{
glBegin(GL_POINTS);
glVertex2d(k,temp+1);
glEnd();
d=d+2*(y1-y0)-2*(x1-x0);
temp=temp+1;
剩余7页未读,继续阅读
资源评论
BYYF520
- 粉丝: 0
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功