91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1010KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-09-21
  • 語言: 其他
  • 標簽:

資源簡介

計算機圖形學的試驗源代碼,使用的是改進后的掃描線填充算法

資源截圖

代碼片段和文件信息

#include?“ggltools.h“


int?gltRound(double?x)
{
return?x?>?0???(int)(x+0.5)?:?(int)(x-0.5);
}

int?gltTrunc(double?x)
{
return?(int)x;
}

void?gltRasterText(double?x?double?y?const?char?*text?void?*font)
{
????if(text?==?NULL)?return?;
????
????glRasterPos2d(x?y);
????for(int?i=0;?text[i]?!=?‘\0‘;?i++)
????{
????????glutBitmapCharacter(font?text[i]);
????}?
}

void?gltLine2i(int?x0?int?y0?int?x1?int?y1)
{
????glBegin(GL_LINES);
glVertex2i(x0?y0);
glVertex2i(x1?y1);
????glEnd();
}

void?gltRect2i(int?x0?int?y0?int?x1?int?y1)
{
????glBegin(GL_LINES);
glVertex2i(x0?y0);
glVertex2i(x1?y0);

glVertex2i(x1?y0);
glVertex2i(x1?y1);

glVertex2i(x1?y1);
glVertex2i(x0?y1);

glVertex2i(x0?y1);
glVertex2i(x0?y0);
????glEnd();
}

void?gltLine2d(double?x0?double?y0?double?x1?double?y1)
{
????glBegin(GL_LINES);
????????glVertex2d(x0?y0);
????????glVertex2d(x1?y1);
????glEnd();
}

void?gltRect2d(double?x0?double?y0?double?x1?double?y1)
{
????glBegin(GL_LINES);
????????glVertex2d(x0?y0);
????????glVertex2d(x1?y0);
????????
????????glVertex2d(x1?y0);
????????glVertex2d(x1?y1);
????????
????????glVertex2d(x1?y1);
????????glVertex2d(x0?y1);
????????
????????glVertex2d(x0?y1);
????????glVertex2d(x0?y0);
????glEnd();
}

bool?gltPtInPolygon(int?x?int?y?const?GPoint2i?*points?int?n)
{
int?crossCount;
GPoint2i?pt0?pt1?pt2;
crossCount?=?0;
????for(int?i=0;?i????{
????????pt0?=?points[i];
????????pt1?=?points[(i+1)%n];
pt2?=?points[(i+2)%n];
????????
????????//?跳過水平邊
????????if(pt0.y()?==?pt1.y())?continue?;
????????
//?點在邊的右邊不可能有交點?跳過?
????????if(x?>?pt0.x()?&&?x?>?pt1.x())?
????????{
????????????continue?;
????????}

????????if((y?-?pt0.y())?*?(pt1.y()?-?y)?>=?0)
????????{
//?計算掃描線交點xm
????????????double?xm?=?pt0.x()+(y-pt0.y())*(pt1.x()-pt0.x())/(pt1.y()-pt0.y());
????????????if(xm?>?x)
????????????{
if(y? if(y?????????????}
????????}
????}
????if(crossCount?%?2?==?1)?return?true;
????else?return?false;
}

struct?EdgeItem?????//?邊表項?
{
int?yMax;
double?x?invk;
EdgeItem?*next;

EdgeItem()
{
yMax?=?0;
x?=?0;
invk?=?0.0;
next?=?0;
}
};

template?
void?swap(T?&aT?&b)
{
???T?t?=?a;
???a?=?b;
???b?=?t;
}

void?gltFillPolygon(const?GPoint2i?*points?int?n)
{
???int?iminmaxidxy;
???GPoint2i?pt0pt1;
???EdgeItem?**?EdgeBucket;
???EdgeItem?*p*q*pEdge*aet;
??
???min?=?max?=?points[0].y();
???for?(i?=?1;?i????{
???if?(min?>?points[i].y())?min?=?points[i].y();
???if?(max????}
//建立空桶
???EdgeBucket?=?new?EdgeItem?*[max-min+1]();
???for?(i?=?0;?i????{
???EdgeBucket[i]?=?new?EdgeItem();
???}
???for?(i?=?0;?i???{
???pt0?=?points[i];
???pt1?=?points[(i+1)%n];

???if?(pt0.y()?==?pt1.y())?con

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????1324076??2010-10-16?22:05??graph\graph\fill-polygon\Debug\FillPoly.pch

?????文件?????582656??2010-11-04?12:43??graph\graph\fill-polygon\Debug\FillPoly.pdb

?????文件???????3931??2010-08-29?22:23??graph\graph\fill-polygon\Debug\gpoint2d.obj

?????文件??????77032??2010-08-29?22:23??graph\graph\fill-polygon\Debug\gpoint2darray.obj

?????文件???????3737??2010-09-14?22:50??graph\graph\fill-polygon\Debug\gpoint2i.obj

?????文件??????77473??2010-09-14?22:50??graph\graph\fill-polygon\Debug\gpoint2iarray.obj

?????文件??????32057??2010-09-28?22:00??graph\graph\fill-polygon\Debug\main.obj

?????文件?????353280??2010-11-30?22:30??graph\graph\fill-polygon\Debug\vc60.idb

?????文件?????126976??2010-11-04?12:43??graph\graph\fill-polygon\Debug\vc60.pdb

?????文件???????4137??2010-09-14?21:12??graph\graph\fill-polygon\FillPoly.dsp

?????文件????????541??2010-08-29?22:22??graph\graph\fill-polygon\FillPoly.dsw

?????文件?????156672??2010-11-30?22:30??graph\graph\fill-polygon\FillPoly.ncb

?????文件??????50688??2010-11-30?22:30??graph\graph\fill-polygon\FillPoly.opt

?????文件???????1247??2010-11-04?12:43??graph\graph\fill-polygon\FillPoly.plg

?????文件???????4457??2010-11-04?12:43??graph\graph\fill-polygon\ggltools.cpp

?????文件????????630??2010-09-28?11:06??graph\graph\fill-polygon\ggltools.h

?????文件????????329??2010-09-14?21:07??graph\graph\fill-polygon\gpoint2i.cpp

?????文件????????487??2010-09-25?14:17??graph\graph\fill-polygon\gpoint2i.h

?????文件???????1773??2010-09-14?22:12??graph\graph\fill-polygon\gpoint2iarray.cpp

?????文件????????927??2010-09-14?22:12??graph\graph\fill-polygon\gpoint2iarray.h

?????文件???????4236??2010-09-28?22:00??graph\graph\fill-polygon\main.cpp

?????文件??????65536??2010-09-14?22:50??graph\graph\fill-polygon\Release\FillPoly.exe

?????文件????1332136??2010-09-14?22:37??graph\graph\fill-polygon\Release\FillPoly.pch

?????文件???????6446??2010-09-14?22:50??graph\graph\fill-polygon\Release\ggltools.obj

?????文件???????1244??2010-08-29?22:43??graph\graph\fill-polygon\Release\gpoint2d.obj

?????文件??????23847??2010-08-29?22:43??graph\graph\fill-polygon\Release\gpoint2darray.obj

?????文件???????1216??2010-09-14?21:09??graph\graph\fill-polygon\Release\gpoint2i.obj

?????文件??????24063??2010-09-14?22:12??graph\graph\fill-polygon\Release\gpoint2iarray.obj

?????文件???????8554??2010-09-14?22:18??graph\graph\fill-polygon\Release\main.obj

?????文件??????50176??2010-09-14?22:50??graph\graph\fill-polygon\Release\vc60.idb

............此處省略19個文件信息

評論

共有 條評論

相關資源