没有合适的资源?快使用搜索试试~ 我知道了~
SutherlandHodgman
需积分: 4 3 下载量 97 浏览量
2009-12-06
22:03:25
上传
评论
收藏 2KB TXT 举报
温馨提示
试读
3页
多边形裁剪SutherlandHodgman函数
资源推荐
资源详情
资源评论
typedef struct{
float x,y;
}Vertex;
typedef Vertex Edge[2];
typedef Vertex VertexArray[100];
void Intersect(Vertex *s,Vertex *p,Edge clipBoundary,Vertex *I)
{
if(clipBoundary[0].y==clipBoundary[1].y)
{
I->y=clipBoundary[0].y;
I->x=s->x+(clipBoundary[0].y-s->y)*(p->x-s->x)/(p->y-s->y);
}
else
{
I->x=clipBoundary[0].x;
I->y=s->y+(clipBoundary[0].x-s->x)*(p->y-s->y)/(p->x-s->x);
}
}
boolean Inside(Vertex *testVertex,Edge clipBoundary)
{
if(clipBoundary[1].x>clipBoundary[0].x)
{
if(testVertex->y>=clipVoundary[0].y)
return TRUE;
}
else if(clipBoundary[1].x<clipBoundary[0].x)
{
float x,y;
}Vertex;
typedef Vertex Edge[2];
typedef Vertex VertexArray[100];
void Intersect(Vertex *s,Vertex *p,Edge clipBoundary,Vertex *I)
{
if(clipBoundary[0].y==clipBoundary[1].y)
{
I->y=clipBoundary[0].y;
I->x=s->x+(clipBoundary[0].y-s->y)*(p->x-s->x)/(p->y-s->y);
}
else
{
I->x=clipBoundary[0].x;
I->y=s->y+(clipBoundary[0].x-s->x)*(p->y-s->y)/(p->x-s->x);
}
}
boolean Inside(Vertex *testVertex,Edge clipBoundary)
{
if(clipBoundary[1].x>clipBoundary[0].x)
{
if(testVertex->y>=clipVoundary[0].y)
return TRUE;
}
else if(clipBoundary[1].x<clipBoundary[0].x)
{
资源评论
xiaoyinxxy
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功