图形学简单总结.docx_第1页
图形学简单总结.docx_第2页
图形学简单总结.docx_第3页
免费预览已结束,剩余6页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

DAA算法:(直线)条件是:1、端点坐标:P0(x0,y0)P1(x1,y1)2、斜率:m=y/x,x=x1-x0y=y1-y03、直线方程:y=mx+B,0m1 交换x和y的位置2、m0 步长dx或dy取-1不足:取证操作和浮点运算仍十分耗时Bresenham画线算法:(圆和曲线)基本原理:从给定线段的左端点开始,逐步处理每个后继列,并在其扫描线y值最接近线段的像素上绘出一点。算法分析:在取样位置xk+1,使用dlower,dupper来表示两个像素与数学路径上的垂直偏移。y=m(xk+1)+b, dlower=y-yk=m(xk+1)+b-yk,dupper=(yk+1)-y=yk+1-m(xk+1)-b决策函数:pk=x(dlower-dupper)=2yxk-2xyk+c,pk+1-pk=2y(xk+1-xk)-2x(yk+1-yk)pk+1=pk+2y-2x(yk+1-yk)yk+1-yk=0或1p0=2y-x|m|1时的算法流程:1、输入线段的两个端点,将左端点存储在(x0,y0)中2、将(x0,y0)装入帧缓存,画出第一个点3、计算常量x、y、2y、2y-2x,并得到决策函数的第一个值4、从k=0开始,在沿线路径的每个 xk 处,进行决策函数检测5、重复步骤4,共x 1 次中点画圆:算法分析:采用圆函数决策函数:fcirc(x,y)=x2+y2-r2pk=fcirc(xk+1,yk-12),两个候选像素的中点,pk0时取yk,反之取yk-1pk+1=pk+2(xk+1)+(yk+12-yk2)-(yk+1-yk)+1,yk+1是yk(pk=yBezier曲线:N次Bezier曲线:Rt=i=0nRiBi,nt,0t1Bernstein基函数Bi,n(t)为:Bi,n(t)=Cni(1-t)n-iti,Cni=n!i!n-i!曲线性质:1、端点插值:R0=R0 , R1=Rn2、端点切向:R0=n(R1-R0), R1=n(Rn-Rn-1)3、对称性:iRn-iBi,nt=iRiBi,nt, 曲线的控制顶点的几何地位是对称的4、凸包性:Bezier曲线位于控制多边形的凸包内5、几何不变性:Bezier曲线的形状仅与控制多边形有关,与坐标系无关不足:1、整体性质:当移动曲线的一个控制定点时,整条曲线的形状都会发生改变2、表示复杂形状时,需要将更多条Bezier曲线光滑的拼接起来Cohen-Sutherland算法:通过初试测试来减少求交计算,从而提高效率特点:对显然不可见的线段快速判别,可直接推广到三维区域编码:用窗口四边所在的直线将整个平面分成9个区域,每个区域赋于一个四位的编码CtCbCrClCt=10 当yymaxelse ,Cb=10 当yxmaxelse,Cl=10 当xMaxDepth) *color=Black;else if(RayHit(start,direction,&hitPoint,&hitObject)=Nothing)*color=BackGround;else Shade(hitObject,hitPoint,&localColor); CalculateReflection(hitObject,hitPoint,direction,&rDirection);CalculateTransmmission(hitObject,hitPoint,direction,&tDirection);TraceRay(hitPoint,rDirection,depth+1,&rColor);TraceRay(hitPoint,tDirection,depth+1,&tColor); CombineColor(localColor,rColor,hitObject.ks,tColor, hitObject.kt,color);Photon Mapping:1、Photon tracinga)Emissionb)Scatteringc)Storing: only on diffuse surface2、Renderinga)Direct lightingb)Specular reflectionc)Causticsd)Indirect lightingZ-Buffering:Z buffering works by holding a depth value for each pixel in the image. Before rendering, the depth value for each pixel is set to the maximum value possible (very deep into the screen). The image is then rendered, polygon by polygon, and instead of just setting a pixel to a certain colour, we perform the following:Is the z screen value(depth) for this point on the polygon smaller(nearer to the viewer)than the depth value in the z buffer for this pixel?Yes:This point is nearer to the viewer than any points that have been written to this pixel previously. Calculate the shade of the pixel and write it to the screen. Write the depth of this point into the z buffer for this pixel.No:Another point has been written to this pixel which is nearer to the viewer.Do not write the pixel. Do not write into the z buffer.Advantages:1、It is easy to implement, and can easily be implemented in hardware. 2、Z buffering can be easily combined with many forms of rendering, polygon, CSG, parametric - the only constraint on the rendering method is the need to calculate the depth of points on an object.3、 Z buffer data can also be retained after rendering, allowing separate 3D images to be easily combined into one.Disadvantages:1、The Z buffer requires a large amount of memory, often more than the display. 2、Pixels are often shaded many times, implying

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论