当前位置: 首页 > news >正文

母婴网站建设初衷/app推广团队

母婴网站建设初衷,app推广团队,rp网站做多大,胶州网站搭建公司圆方程为非线性的,计算像素与圆的距离必须进行平方运算,Bresenham画圆方法则通过比较像素与圆的距离的方法而避免了平方根运算。然而,不做平方运算而直接比较距离是可能得。该方法的基本思想是检验两像素间的中间位置以确定该中点是在圆边界值…

圆方程为非线性的,计算像素与圆的距离必须进行平方运算,Bresenham画圆方法则通过比较像素与圆的距离的方法而避免了平方根运算。

然而,不做平方运算而直接比较距离是可能得。该方法的基本思想是检验两像素间的中间位置以确定该中点是在圆边界值内还是之外。

【注】算法代码如下,其中void

circleBresham(GLint xc,GLint yc,GLint radius)为用Bresenham算法画圆的算法,而其中void circleMidpoint(GLint xc,GLint yc,GLint

radius)为中点画圆的算法:

#include

#include

#ifdef __APPLE__

#include

#else

#include

#endif

#include

void init (void)

{

glClearColor(0.0, 1.0, 0.0, 0.0); // Set display-window

color to white.

glMatrixMode (GL_PROJECTION);

// Set projection parameters.

gluOrtho2D (0.0, 200.0, 0.0, 150.0);

}

class screenPt

{

private:

GLint x,y;

public:

screenPt(){

x = y =0;

}

void setCoords(GLint xCoordValue,GLint yCoordValue){

x = xCoordValue;

y = yCoordValue;

}

GLint getx() const

{

return x;

}

GLint gety() const

{

return y;

}

void incrementx()

{

x ++;

}

void decrementy()

{

y--;

}

};

void setPixel(GLint xCoord,GLint

yCoord)

{

glBegin(GL_POINTS);

glVertex2i(xCoord,yCoord);

glEnd();

//glFlush();

}

void circleMidpoint(GLint

xc,GLint yc,GLint radius)

{

glColor

3f(1.0,0.0,0.0);

screenPt circPt;

GLint p = 1 - radius;

circPt.setCoords(0,radius);

void circlePlotPoints(GLint,GLint,screenPt);

circlePlotPoints(xc,yc,circPt);

while(circPt.getx()< circPt.gety())

{

circPt.incrementx();

if (p<0){

p += 2*circPt.getx() + 1;

}

else{

circPt.decrementy();

p += 2*(circPt.getx() - circPt.gety()) + 1;

}

circlePlotPoints(xc,yc,circPt);

}

}

void circleBresham(GLint

xc,GLint yc,GLint radius)

{

glColor3f(1.0,0.0,0.0);

screenPt circPt;

//GLint p = 1 - radius;

circPt.setCoords(0,radius);

void circlePlotPoints(GLint,GLint,screenPt);

circlePlotPoints(xc,yc,circPt);

while(circPt.getx()< circPt.gety())

{

GLint x1,x2,y1,y2;

circPt.incrementx();

x1 = circPt.getx();

y1 = circPt.gety();

x2 = circPt.getx();

y2 = circPt.gety()-1;

//if

((x1*x1+y1*y1-radius*radius)

//}

if

(fabs(x1*x1+y1*y1-radius*radius)>fabs(x2*x2+y2*y2-radius*radius)){

circPt.decrementy();

// p += 2*(circPt.getx() - circPt.gety()) + 1;

}

circlePlotPoints(xc,yc,circPt);

}

}

void circlePlotPoints(GLint xc,GLint yc,screenPt

circPt)

{

setPixel(xc + circPt.getx(),yc + circPt.gety());

setPixel(xc - circPt.getx(),yc + circPt.gety());

setPixel(xc + circPt.getx(),yc - circPt.gety());

setPixel(xc - circPt.getx(),yc - circPt.gety());

setPixel(xc + circPt.gety(),yc + circPt.getx());

setPixel(xc - circPt.gety(),yc + circPt.getx());

setPixel(xc + circPt.gety(),yc - circPt.getx());

setPixel(xc - circPt.gety(),yc - circPt.getx());

}

void pointsFun(void)

{

glPointSize(3.0);

glEnable(GL_POINT_SMOOTH);

glClear(GL_COLOR_BUFFER_BIT);

circleBresham(100,100,30);

glFlush();

}

int main (int argc, char** argv)

{

glutInit (&argc, argv);

// Initialize GLUT.

glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); //

Set display mode.

glutInitWindowPosition (50, 100); //

Set top-left display-window position.

glutInitWindowSize (400, 300);

// Set display-window width and height.

glutCreateWindow ("An Example OpenGL Program"); // Create display

window.

init();

// Execute initialization procedure.

glutDisplayFunc (pointsFun);

// Send graphics to display window.

glutMainLoop ( );// Send graphics to display window.

// Display everything and wait.

return 0;

}

http://www.jmfq.cn/news/5301793.html

相关文章:

  • 手机电影网站建设/企点qq
  • 宿迁做网站 宿迁网站建设/辅导机构
  • favicon.ico 网站的根目录/baike seotl
  • 怎么在企业站建立网站吗/百度下载app
  • 做交易网站/简述搜索引擎优化
  • 自己做抽奖网站违法/西安抖音seo
  • 彩票网站建设柏/免费测试seo
  • 有哪些图片设计网站有哪些问题/百度站长平台链接提交
  • 安卓手机做服务器网站/互联网营销师证书怎么考
  • 公司备案可以做购物网站吗/搜狗推广平台
  • 广告网站建设制作设计/百度竞价排名多少钱
  • 阿里云服务器的网站备案/百度站长平台登录
  • 全球网站建设服务商/软文写作经验
  • 哈尔滨在线制作网站/seo运营
  • 大石桥网站建设/网站优化平台
  • 做高级电工题的网站/外链seo推广
  • 哪个网站做ppt赚钱/怎样在百度上做广告推广
  • 企业网站建设目的选择题/深圳网络推广大师
  • 强化 门户网站建设/市场监督管理局官网入口
  • 网站怎样做的高大上/今日重大新闻头条
  • wordpress类似的前端/seo手机搜索快速排名
  • wwe中文官网站/武汉百度推广多少钱
  • 做暖暖小视频老司机网站/网站推广方式组合
  • 可以看男男做的视频网站/大数据营销成功案例
  • 怎么直接做免费网站/企业营销策划包括哪些内容
  • 新乡移动网站建设/自己有网站怎么推广
  • 无锡大型互联网公司/seo关键词优化外包
  • 苏州网站建设哪家公司好/上海关键词优化报价
  • 国内室内设计网站大全/免费广告网
  • 用织梦做的网站好还是cms/简述获得友情链接的途径