计算机图形学基础教程习题课2(第二版)(孙家广-胡事民编著)
- 格式:doc
- 大小:1.06 MB
- 文档页数:4
解析⼏何之⼆次型解析⼏何之⼆次型Abstract. 通过⼆次多项式的形式把⼆次曲线和⼆次曲⾯之间的求交问题统⼀成对将参数⽅程代⼊隐式⽅程得到问题的求解。
Key Words. Quadratic Form, Conic, Analytical Intersection1. Introduction⼆次型(quadratic form):n个变量的⼆次多项式称为⼆次型,即在⼀个多项式中,未知数的个数为任意多个,但每⼀项的次数都为2的多项式。
线性代数的重要内容之⼀,它起源于⼏何学中⼆次曲线⽅程和⼆次曲⾯⽅程化为标准形问题的研究。
⼆次型理论与域的特征有关。
⼆次型是n个变量上的⼆次齐次多项式。
下⾯给出⼀个、两个、和三个变量的⼆次形式:其中a, ...,f是系数。
注意⼀般的⼆次函数和⼆次⽅程不是⼆次形式的例⼦,因为它们不总是齐次的,可能包含⼀次项和常数项。
⼏何造型中的圆锥曲线Conic Curve与⼆次曲⾯Quadric是⼀般的⼆次⽅程,⽅程分别为:在学习《线性代数》时也有关于⼆次型及其标准型的内容,在同济第四版《线性代数》书中这样写到“⼆次型及其标准型,这样⼀个问题,在许多理论问题或实际问题中常会遇到,现在我们把这类问题⼀般化,讨论n个变量的⼆次齐次多项式的化简问题。
” 学这个有什么⽤啊?能解决哪些实际问题?下⾯我们看看⼆次型在实际问题中的应⽤。
2. Classification在《⼯程技术中的偏微分⽅程》⼀书中,有⼆次型的⼀个应⽤,即对⼆次线性⽅程的分类Classification。
我们从实际问题出发,可以推导并建⽴热传导⽅程,波动⽅程和Laplace⽅程,同时指出他们分别是抛物型、双曲型和椭圆型三类⽅程的典型代表。
设有⼆阶线性⽅程在解析⼏何中,XOY平⾯上的⼆次曲线⽅程的⼀般形式:通过适当的坐标变换可以将上式化简成椭圆、双曲线和抛物线的标准⽅程,即对于任意⼆次圆锥曲线,都可以通过化成标准型的⽅法来判断圆锥曲线的类型。
第一章绪论概念:计算机图形学、图形、图像、点阵法、参数法、图形的几何要素、非几何要素、数字图像处理;计算机图形学和计算机视觉的概念及三者之间的关系;计算机图形系统的功能、计算机图形系统的总体结构。
第二章图形设备图形输入设备:有哪些。
图形显示设备:CRT的结构、原理和工作方式。
彩色CRT:结构、原理。
随机扫描和光栅扫描的图形显示器的结构和工作原理。
图形显示子系统:分辨率、像素与帧缓存、颜色查找表等基本概念,分辨率的计算第三章交互式技术什么是输入模式的问题,有哪几种输入模式。
第四章图形的表示与数据结构自学,建议至少阅读一遍第五章基本图形生成算法概念:点阵字符和矢量字符;直线和圆的扫描转换算法;多边形的扫描转换:有效边表算法;区域填充:4/8连通的边界/泛填充算法;内外测试:奇偶规则,非零环绕数规则;反走样:反走样和走样的概念,过取样和区域取样。
5.1.2 中点Bresenham 算法(P109)5.1.2 改进Bresenham 算法(P112)习题解答习题5(P144)5.3 试用中点Bresenham算法画直线段的原理推导斜率为负且大于1的直线段绘制过程(要求写清原理、误差函数、递推公式及最终画图过程)。
(P111)解:k<=-1 |△y|/|△x|>=1 y为最大位移方向故有构造判别式:推导d各种情况的方法(设理想直线与y=yi+1的交点为Q):所以有:y Q-kx Q-b=0 且y M=y Qd=f(x M-kx M-b-(y Q-kx Q-b)=k(x Q-x M)所以,当k<0,d>0时,M点在Q点右侧(Q在M左),取左点 P l(x i-1,y i+1)。
d<0时,M点在Q点左侧(Q在M右),取右点 Pr(x i,y i+1)。
d=0时,M点与Q点重合(Q在M点),约定取右点Pr(x i,y i+1) 。
所以有递推公式的推导:d2=f(x i-1.5,y i+2)当d>0时,d2=y i+2-k(x i-1.5)-b 增量为1+k=d1+1+k当d<0时,d2=y i+2-k(x i-0.5)-b 增量为1=d1+1当d=0时,5.7 利用中点Bresenham 画圆算法的原理,推导第一象限y=0到y=x圆弧段的扫描转换算法(要求写清原理、误差函数、递推公式及最终画图过程)。
装订首页
工业学院教案
课程:计算机图形学
学期:2013/14第一学期
课时:理论52,实验12
教材:计算机图形学基础教程
计算机图形学实践教程
教师:孔令德静丽亚
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案
工业学院教案。
第一章:P561、列出在你过去学习工作中用过与计算机图形学有关的程序c语言:#include <graphics.h>main(){int graphdriver = VGA, graphmode=VGAHI;initgraph(&graphdriver,&graphmode,””);setbkcolor(BLUE);setcolor(WHITE);setfillstyle(1,LIGHTRED);bar3d(100,200,400,350,100,1);floodfill(450,300,WHITE);floodfill(250,450,WHITE);setcolor(LIGHTGREEN);rectangle(450,400,500,450);floodfill(470,420,LIGHTGREEN);getch();closegraph();}JA V A语言:例1、画点Import java.io.*;Class point{int ax;int ay;int bx;int by;public point(int ax, int ay, int bx, int by){float k ; //计算斜率float b;k=(by-ay)/(bx-ax);b=ay-ax*k;system.out.println(“直线的方程为:y=”+k+”x”+”+”+b);}}例2、画矩形class DrawPanel extends Jpanel{public void paint(Graphics g){super.paint(g);Graphics2D g2= (Graphics 2D);Double leftx=200;Double topy=200;Double width=300;Double height=250;Rectangle2D rect= new Rectangle2D.double(leftx,topy,width,height);G2.draw(rect);}}2、列出你所用过的窗口系统中与观感有关的元素的功能,如图标、滚动棒、菜单等使用滚动条当文档、网页或图片超出窗口大小时,会出现滚动条,可用于查看当前处于视图之外的信息。
华中科技大学计算机图形学课后习题指导一、第五章5.3 试用中点Bresenham算法画直线段的原理推导斜率为负且大于1的直线段绘制过程(要求写清原理、误差函数、递推公式及最终画图过程)。
分析:这是典型的算法推导题,推导时需要首先确定最大位移方向,然后根据最大位移方向确定候选点,并利用候选点的中点构造判别式;根据判别式确定选择候选点的条件,然后确定判别式的递推公式以及初值。
解:5.7 利用中点Bresenham画圆算法的原理推导第一象限x=y到y=0圆弧段的扫描转换算法(要求写清原理、误差函数、递推公式及最终画图过程)。
分析:这是典型的算法推导题,推导时需要首先确定最大位移方向,然后根据最大位移方向确定候选点,并利用候选点的中点构造判别式;根据判别式确定选择候选点的条件,然后确定判别式的递推公式以及初值。
圆算法应该注意的是算法是从理想圆与坐标轴交点开始的。
解:在x=y到y=0的圆弧中,(R, 0)点比在圆弧上,算法从该点开始。
最大位移方向为y,由(R, 0)点开始,y渐增,x渐减,每次y方向加1,x方向减1或减0。
(注意算法的起始点)设P点坐标(xi, yi),下一个候选点为Pr(xi, yi+1)和Pl(xi-1, yi+1),取Pl和Pr的中点M(xi-0.5, yi+1),设理想圆与y=yi+1的交点Q,构造判别式:d=F(xM, yM)=(x-0.5)2+(y+1)2-R2当d<0时,M在Q点左方,取Pr(xi,yi+1);当d>0时,M在Q点右方,取Pl(xi-1,yi+1);当d=0时,M与Q点重合,约定取Pl(xi-1, yi+1)。
5.11 如图所示多边形,若采用扫描转换算法(ET边表算法)进行填充,试写出该多边形的ET表和当扫描线Y=4时的有效边表(AET表,活性边表)。
分析:改进的有效边表算法是用软件方法实现扫描转换效率较高的算法,它利用了边表来构造有效边表。
需要注意的有以下几点:(1)构造边表时,水平边不需要构造,算法能够获取到水平边的两个端点,配对填充后水平边被填充,因此水平边的数据不参与计算。
计算机图形学基础教程孔令德课后答案【篇一:大学计算机图形学课程设】息科学与工程学院课程设计任务书题目:小组成员:巴春华、焦国栋成员学号:专业班级:计算机科学与技术、2009级本2班课程:计算机图形学指导教师:燕孝飞职称:讲师完成时间: 2011年12 月----2011年 12 月枣庄学院信息科学与工程学院制2011年12 月20日课程设计任务书及成绩评定12【篇二:计算机动画】第一篇《计算机图形学》小结《计算机图形学》第一章:从计算机的辅助设计,艺术,和虚拟现实技术等方面介绍了计算机图形学的应用领域;接下了解了有关计算机图形学的概念和发展情况和图新显示器的发展和阴极射线管光栅扫描显示等的工作原理;最后介绍了图形学的最新技术。
第二章:介绍了面向对象程序设计,visual c++下的编程,主要基于mfc的编程,更重要的是绘制图形的方法。
第三章:图形的扫描与转换:主要分两部分,一是:直线,圆,和椭圆的扫描和转换中的一些重要而经典的算法。
二是:反走样技术,尤其,直线距离加权反走样的算法。
第四章:主要介绍了多边形填充,有多边形的的概述到有效边表填充,边缘填充,最后区域填充的原理和算法第五章:二维变换和裁剪:主要介绍了裁剪的方法:cohen sutherland算法是最著名的算法,除此之外还有重点分割裁剪算法,梁友栋——barsky算法。
第二篇计算机动画2.1计算机动画的概念:计算机动画是指采用图形与图像的处理技术,借助于编程或动画制作软件生成一系列的景物画面,其中当前帧是前一帧的部分修改。
计算机动画是采用连续播放静止图像的方法产生下图1-1几幅图片就是用计算机动画(a)(b)(c)(d)图2-1 计算机动画示例2.2 计算机动画的发展:计算机动画的发展大致分为三阶段:第一阶段:初出茅庐阶段:20世纪60年代初。
第一部计算机动画片诞生,之后大约20年,二维动画是计算机动画研究的重心,同时,二维动画也被应用于教学演示和辅助传统的动画片制作。
Computer GraphicsShi-Min HuShi Min HuTsinghua UniversityTsinghua UniversityToday s TopicsToday’s Topics•Why splines?•B-Spline Curves and properties •B-Spline surfacesB Spline surfaces•NURBS curves and SurfacesWhy to introduce B Spline(BWhy to introduce B-Spline (B样条)•Bezier curve/surface has many advantages, but they have two main shortcomings:e e cu ve/su ace ca ot be od ed oca y–Bezier curve/surface cannot be modified locally(局部修改).–It is very complex to satisfy geometric continuityIt i l t ti f t i ti itconditions for Bezier curves or surfaces joining.•History of B-splinesI1946S h b d li b d–In 1946, Schoenberg proposed a spline-basedmethod to approximate curves.–It’s motivated by runge-kutta problem ininterpolation: high degree polynomial may surge p g g p y y g upper and down–Why not use lower degree piecewise polynomial Wh t l d i i l i lwith continuous joining?–that’s Spline–But people thought it’s impossible to use Spline in shape design because complicatedin shape design, because complicated computation–In 1972, based on Schoenberg’s work, Gordon I1972b d S h b’k G d and Riesenfeld introduced “B-Spline” and lots of corresponding geometric algorithms.f di i l i h–B-Spline retains all advantages of Bezier curves, and overcomes the shortcomings of Bezier curves.•Tips for understanding B-Spline?–Spline function interpolation is well known, it can Spline function interpolation is well known it canbe calculated by solving a tridiagonalequations(三对角方程).i–For a given partition of an interval, we cancompute Spline curve interpolation similarly.–All splines over a given partition will form aAll splines over a given partition will form alinear space. The basis function of this linearspace is called B-Spline basis function.i ll d B S li b i f i–Similar to Bezier Curve using Bernstein basis functions, B-Spline curves uses B-Spline basis f nctions B Spline c r es ses B Spline basis functions.B-Spline curves and it’s p Properties•Formula of B-Spline Curve.n ]1,0[),()(,0∈=Σ=t t B P t P n i i n i are control points ∑==i k i i t N P t P 0,)()(–are control points. –(i=0,1,..,n) are the i-th B-Spline basis function ),,1,0(n i P i L =)(,t N k i of order k. B-Spline basis function is a order k (degree k -1) piecewise polynomial (分段多项式) determined by the knot vector, which is a non-decreasing set of numbers.g•Demo of B-splineThe story of order & degree•The story of order°ree–G Farin: degree, Computer Aided Geometric Design –Les Piegl: order, Computer Aided DesignL Pi l d C Aid d D iB Spline Basis Function B-Spline Basis Function•Definition of B-Spline Basis Function –de Boor-Cox recursion formula:⎧⎩⎨<<=+Otherwiset x t t N i i i 01)(11,−−,,11,111()()()i i k i k i k i k i k i i k i t t t t N t N t N t t t t t +−+−+−++=+−−–Knot Vector: a sequence of non-decreasing number L L L k n k n n n k k t t t t t t t t +−++−,,,,,,,,,,11110L L L•, i = 01k=•, i = 02k=⎧⎩⎨<<=+Otherwiset x t t N i i i 01)(11,,,11,111()()()i i k i k i k i k i k i i k i t t t t N t N t N t t t t t +−+−+−++−−=+−−B Spline Basis Function B-Spline Basis Function•Questions:–What is nonzero domain(非零区间) of B-Splinebasis function ?)(,t N k i –How many knots does it need?Wh t i th d fi iti d i ()f th –What is the definition domain(定义区间) of the curves?4,4()()i i P t PN t =∑0i =B Spline Basis Function B-Spline Basis Function•take k=4, n=4 as example 4,4()()i i P t PN t =∑876543210,,,,,,,,t t t t t t t t t 0i=B Spline Basis Function B-Spline Basis Function•Properties:N ti it d l l t–Non-negativity and local support •is non-negativeis a non ero pol nomial on ,()i k N t ]•is a non-zero polynomial on ⎧∈≥+t t t t N k i i ],[0[,i i k t t +,()i k N t –Partition of Unity⎩⎨=otherwisek i 0)(,•The sum of all non-zero order k basis functions onis 1 ∑n 11[,]k n t t −+=+−∈=i n k k i t t t t N011,],[1)(B Spline Basis Function B-Spline Basis Function•Properties:Diff ti l ti f th b i f ti–Differential equation of the basis function:,,11,11111()()()i k i k i k i k i i k i k k N t N t N t t t t t −+−+−++−−′=+−−–Please compare with the Bernstein base:)]B 10 )],()([)(1,1,1,n i t B t B n t n i n i n i ⋅⋅⋅=−=′−−−;,,,B SplineB-Spline•Category(分类) of B-Splineg g p–General Curves could be categorized to two groups by checking if the start point and the endpoint areoverlapped:•Open Curves•Close CurvesClose Curves–According to the distribution(分布) of the knots inknot vector, B-Spline could be classified to theknot vector B Spline could be classified to thefollowing four groups:Uniform B-Spline(均匀B样条)U if B S li–(1) Uniform B-Spline,,,,,,,,•The knots are uniformed distributed, like 0,1,2,3,4,5,6,7•This kind of knot vector defines uniform B-Spline basisfunctionuniform B-Spline of Degree 3if B S li f D3Quasi Uniform B Spline(Quasi-Uniform B-Spline(准均匀B样条)–(2) Quasi-Uniform B-Splinep•Different from uniform B-Spline, it has:–the start-knot and end-knot have repetitiveness(重复度) of k–Uniform B-Spline does not retain the “end point” property ofBezier Curve, which means the start point and end point ofuniform B-Spline are no-longer the same as the start point andend point of the control points. However, quasi-Uniform B-end point of the control points However quasi Uniform BSpline retains this “end point” propertyQuasi-uniform B-Spline curve of degree 3Piecewise Bezier Curve(Piecewise Bezier Curve(分段Bezier曲线)–(3) Piecewise Bezier Curvep()•the start-knot and end-knot have repetitiveness(重复度)of kp•all other knots have repetitiveness of k-1•Then each curve segment will be Bezier curvesPiecewise B-Spline Curve of degree 3Piecewise Bezier Curve(分段Bezier曲线) Piecewise Bezier Curve(•For piecewise Bezier curve, the different pieces of th l ti l i d d t M i ththe curve are relatively independent. Moving the control point will only influence the corresponding piece of curve, while other pieces of curves will be not change. Furthermore, the algorithms for Bezier not change.Furthermore,the algorithms for Bezier could also be used for piecewise Bezier Curve.•But this method need more data to define the curve (more control points, more knots).Non-uniform B-Spline (非均匀B p (样条)–(4) Non-uniform B-Spline•The knot vectors satisfy T t t t =L e o vec o s sa s y conditions that the sequence of knots is non-)01[,,,]n k +decreasing(非递减). –repetitiveness of two end knots, <= k –repetitiveness of other knots, <= k-1•This kind of knot vector defines the non-uniformB-Spline.Properties of B Spline Curves Properties of B-Spline Curves•Properties of B-Spline curvesL l(–Local(局部性)•The curve in interval is only affected ],[1+∈i i t t t by at most k control points , and is independent of other control points.),,1(i k i j P j L +−=•Changing the position of control point will only affect the curve on interval i P only affect the curve on interval),(k i i t t +n∑==i k i i t N P t P 0,)()(Properties of B Spline Properties of B-Spline–Continuity(连续性)P()i i d f i i•P(t) is continuous at a node of repetitiveness r.–Convex hull(凸包性)1k r C −−•A B-spline curve is contained in the convex hullof its control polygon More specifically if t is of its control polygon. More specifically, if t is in knot span , then P(t) is in the h ll f t l i t n i k t t i i ≤≤−+1),,(1convex hull of control points ik i P P ,,1L +−Properties of B Spline Properties of B-Spline–Piecewise polynomial (分段多项式)•In every knot span, P(t) is a polynomial of t whose y p ()p ydegree is less than k.–Derivative formula(Derivative formula(导数公式)′′nn)()()(0,0,'===⎟⎠⎞⎜⎝⎛=∑∑i k i i i k i i t N P t N P t P ],[)()1(111,111+−−=−+−∈⎟⎟⎠⎞⎜⎜⎝⎛−−−=∑n k k i ni i k i i i t t t t N t t P PkProperties of B SplineProperties of B-Spline–Variation Diminishing Property(变差缩减性)•this means no straight line intersects a B-splinethi t i ht li i t t B licurve more times than it intersects the curve'scontrol polygons.t l l–Geometry invariability(几何不变性)•The shape and position of curve are independentwith the choosing of coordinate system(坐标系).Properties of B Spline Properties of B-Spline–Affine invariability(仿射不变性)nI h h f f i i i i bl d h∑=+−∈=i n k k i i t t t t N P A t P A 011,],[,)(][)]([•It means that the form of equation is invariable under the affine transformation.–Line holding(直线保持性)•It means that if the control polygon degenerates to a line,the B-Spline curve also degenerates to a line.Properties of B Spline Properties of B-Spline–Flexibility(灵活性)U i B S li C il t t•Using B-Spline Curve we can easily construct special cases such as line segment(线段), cusp(尖)t t li ()点), tangent line(切线).•For example, for B-Spline of order 4 (degree 3), if li l dyou want to construct a line segment, you only need to specify collinear (共线). 321,,,+++i i i i P P P P •you only need to let12i i i P P P ++==Properties of B Spline Properties of B-Spline相•If you want the curve tangent(相切) to a specific line L,you only need to specify on line L, and21,,++i i i P P P repetitiveness of less than 2.3+i t iP 1+i P 2+i P P )(tPP 4+i (a)四顶点共线(b)二重顶点和三重顶点−i P 23()重节点和三重节点(c)二重节点和三重节点(d)三顶点共线图.1.26 三次B样条曲线的一些特例De Boor Algorithm De Boor Algorithm•To compute P(t) (a point on the curve), you could use B-Spline formula, but it is more efficient to use de pBoor algorithm.De Boor Algorithm:•De Boor Algorithm:)()()(,,==∑∑jki ink i i t NP t N P t P 10−+−+−==⎤⎡−+−=jk i i k j i i t N tt t N t t P )()(111,111,1−++−=+++−+⎤⎡−−⎥⎦⎢⎣−−∑jk i i k j i k i i k i k i i k i i t t t t t t t t ],[)(11,1111+−+−=−−+−+∈⎥⎦⎢⎣−+−=∑j j k i k j i i i k i i i k i t t t t N P t t P t tDe Boor Algorithm De Boor Algorithm•Let⎧⋅⋅⋅+−+−==k k i r P ,,2,1,0,⎪⎪⎨−−+−−=−−−+−t P t t t t t P t t t t jj j t P r i r k i r i i i r i ),()()(]1[1]1[][•Then⎪⎪⎩⋅⋅⋅++−++−=−⋅⋅⋅=−+−+j r k j r k j i k r ir k i i r k i ,,2,1;1,,2,1∑∑−==jk i ijki it N t Pt NP t P 1,]1[,)()()()(•This is De Boor Algorithm.+−=+−=k j i k j i 21De Boor Algorithm De Boor Algorithm•The recursion of De Boor Algorithm is as shown below:01P P 1[1]j k P −+M 22[1][2]333j k j k j k j k j k P PP P P −+−+−+−+−+→→→[1][2][1]k j jjjP PPP−→→M M M M nP MDe Boor Algorithm De Boor Algorithm•Geometric meaning (几何意义)of De Boor Algorithm–It has an intuitive geometric interpretation: corner g pcutting (割角).•It means that using line segment to cut][][r r It means that using line segment to cut corner . Begin frompolygon1i i P P +]1[−r i P ⋅⋅⋅polygon , after k-1 steps of cutting, fi ll i j k j k j P P P +−+−21P −P P j we finally get point on the curve P(t).)(]1[t r j +−k j P −P]1[P 4+−k j 1+−k j 2+k j jKnot Insertion Knot Insertion •Knot insertion–An important tool for practical interactive use of B-p pspline, which allows one to add a new knot to a B-spline without changing the shape or its degree.For spline without changing the shape or its degree. For instance, one may want to insert additional knots in order to be able to raise flexibility of shape control order to be able to raise flexibility of shape control.•Insert a new knot t to a knot span Th k t t b[]1,+i i t t •The knot vector becomes:[]k n i i t t t t t t T ++=,,,,,,,1101L L •denoted as:[]11121111101,,,,,,,1++++=k n i i i tt t t t t T L LKnot Insertion Knot Insertion•The new knot sequence defines a new group of B-Spline Basis F nctions The original c r e Spline Basis Functions. The original curve P(t)can be expressed by this new group of BasisFunctions and new control points , which are unknown.1jP +=111n t N P t P ∑=0,)()(j kjjKnot Insertion Knot Insertion•Boehm gives a formula for computing new control points:p ⎪⎧+−==1,,1,0 ,11k i j P P j j L ββ⎪⎩⎨++−==−+−=+−=−−1,,1 ,,,2 ,)1(111n r i j P P r i k i j P P P j jj j j j j L L ββj t t −=β•r is the repetitiveness of newly inserted knot in the knot jk j j t t −−+1s t e epet t ve ess o ew y se ted ot t t e ot sequence.Knot Insertion Knot Insertion1P 1P P 1P 03i points(totally k-1points)36points( totally k 1 points) are replaced by the right ones(totally k points)],[43t t t ∈See demo of knot insertionB Spline Surface(B B-Spline Surface(B样条曲面)•Given knot vectors in axes(参数轴) U and V:],,,[10p m u u u U +=L B S li f f d i d fi d],,,[10q n v v v V +=L •B-Spline surface of order p ×q is defined as:m n∑∑===i j q j p i ij v N u N P v u P 00,,)()(),(B Spline Surface B-Spline Surface•are the control points of B-Splineij P Surface, which are usually referred to as thecontrol net ).(控制网格、特征网格)•and are B-Spline basis)(,u N p i )(,v N q j functions of order p and q , one for each direction (and ),which could also be direction (U and V ), which could also be computed by de Boor-Cox formula.B Spline Surface B-Spline Surface03P 23P33P02P 22P 12P32P01P 11P 21P 31P P 10P 20P 0030PNURBS Curve and SurfaceNURBS Curve and Surface •Disadvantage of B-Spline curve and Bezier Curve:–can’t accurately represent conic(圆锥曲线) curveexcept parabola(抛物线),NURBS (Non Uniform Rational B Spline) •NURBS(Non-Uniform Rational B-Spline) (非均匀有理B样条)–In order to find a mathematical method that couldrepresent conic and conicoid(二次曲面) accurately. yNURBS•NURBS is too complex•Les Piegl s The NURBS Book,Les Piegl’s The NURBS Book–“NURBS from Projective Geometry to Practical Use”–Les Piegl,Graduated from Budapest University ofi l d d f d i i fHungary, many years in SDRC company for geometricmodeler designd l d iNURBSSome years ago a few researchers joked about NURBS,saying that the acronym really stands for NOBODYUnderstands Rational B-Splines, write the authors in their foreword; they formulate the aim of changing NURBS to EURBS, that is, Everybody.…There is no doubt that they have achieved this goal....I highly recommend the book to anyone who is interestedp y p in a detailed description of NURBS. It is extremely helpful for students, teachers and designers of geometric modeling ysystems. ——Helmut PottmannNURBS•Advantages of NURBS–It provide a general and accurate representation forrepresenting and designing free curves or surfaces(自由曲线曲面)–They offer one common mathematical form for bothstandard analytical shapes (e.g., conics) and free-formshapes (parametric form).–can be evaluated reasonably fast by numerically stableand accurate algorithms;NURBS•Advantages of NURBS–They are invariant under affine as well as perspectivetransformations.–the control points and weights can be modified, whichgives great flexibility for designing curves/surfaces.–non-rational B-Spline, non-rational and rational Beziercould be viewed as special cases of NURBS.NURBS•Some difficult problems in using NURBS –Require more storage than traditionalcurve/spline methods. (such as circle representation) p–If the weights are set inappropriately, the curvewill be abnormal(畸变).will be abnormal()–It is very complex to deal with situations likecurve overlap(曲线重叠).NURBS •Before discussing about NURBS, let’s first review the definition of B-Spline:n∑==i k i i t N P t P 0,)()()()()(1,111,1,t N t t t t t N t t t t t N k i i k i k i k i i k i i k i −++++−−+−−+−−=k n k n n n k k t t t t t t t t +−++−,,,,,,,,,,11110L LLNURBS•Definition of NURBS curve.–NURBS Curves are defined by piecewiserational B-Spline polynomial basis functionp p y(分段有理B样条多项式基函数):∑== =nnikiiitNP,)(ω∑∑==ikiinikiitRPtNtP,0,)( )()(ω=nki ik itNtR, ,)()(ω∑=jkjjt N,)(ωDefinition of NURBS Definition of NURBS•NURBS basis R i,k (t) retains all properties of B-Spline Basis.–Local support: Ri,k(t)=0,t ∉[ti, ti+k]–Partition of Unity:∑n Partition of Unity:–Differentiability(可微性): If is not a knot is infinitely differentiable()==i k i u R 0,1)(•If t is not a knot, P(t)is infinitely differentiable(无限次可微) in the knot interval. If t is a knot, P(t) is only C-(k-r) continuous.continuous. –If ωi =0, then R i,k (t)=0;If +th R (t)1–If ωi =+∞, then R i,k (t)=1;Definition of NURBSDefinition of NURBS•NURBS curve has similar geometric properties as the B Spline C r e:the B-Spline Curve:–Local support (局部支持性).–Variation Diminishing Property(变差缩减性)–Strong Convex hull(凸包性)–Affine invariability(仿射不变性)–Differentiability(y(可微性)–If the weight of a control point is 0, then correspondingcontrol point doesn t affect the curve.control point doesn’t affect the curve.Definition of NURBS Definition of NURBS–If , and , then N i l/i l B i d ∞→i ω],[k i i t t t +∈i P t P =)(–Non-rational/rational Bezier curves and non-rational B-Spline curves are special cases ofNURBS curve.。
破碎刚体三角网格模型的断裂面分割李群辉;周明全;耿国华【摘要】针对基于断裂面匹配的破碎刚体复原,提出了一种分割断裂面的方法.首先,根据相邻三角片法矢的夹角,将碎块外表面以棱边为界限分割成多张曲面;然后,根据曲面法矢的扰动大小和扰动图像,经过二次分割,将曲面区分为原始面和断裂面.实验结果表明,所提方法能够正确快速地提取出形状较复杂碎块的断裂面.%A method that segmented fracture surfaces for automatic reassembly of broken 3D solids was presented.Firstly, the fragments were segmented into a set of surfaces bounded by sharp curves according to the angle of notmal vectors of adjacent triangles. Then according to perturbation value and perturbation image of the normal vectors. after the second segmentation. surface were divided into the original surface and fractures. The experimental results show that the proposed method can distinguish fractured surfaces of complex fragment correctly and quickly.【期刊名称】《计算机应用》【年(卷),期】2011(031)008【总页数】3页(P2204-2205,2216)【关键词】破碎刚体复原;断裂面分割;法矢夹角;法矢扰动【作者】李群辉;周明全;耿国华【作者单位】西北大学,信息科学与技术学院,西安710069;长安大学,理学院,西安710064;北京师范大学信息科学与技术学院,北京100875;西北大学,信息科学与技术学院,西安710069【正文语种】中文【中图分类】TP391.4130 引言破碎刚体的复原问题,是计算机视觉、模式识别和机器智能中一个有待解决的问题,在古生物学、文物保护、工业设计和临床医学等方面有着重要的应用价值。
习题3-1 参数曲线曲面有几种表示形式? (1) 代数形式一条三次曲线的代数形式是:⎪⎩⎪⎨⎧+++=∈+++=+++=zz z z y y y y x x x x a t a t a t a t z t a t a t a t a t y a t a t a t a t x 012233012233012233)(]1,0[)()((2) 几何形式描述参数曲线的条件有:端点位矢、端点切矢、曲率等。
]1,0[)(11001100∈'+'++=t P G P G P F P F t P上式是三次Hermite(Ferguson)曲线的几何形式,F 0,F 1,G 0,G 1称为调和函数(或混合函数)。
习题3-2 设有控制顶点为P 0(0,0),P 1(48,96),P 2(120,120),P 3(216,72)的三次B ézier 曲线P (t ),试计算P (0.4)的(x ,y )坐标,并写出(x (t ),y (t ))的多项式表示。
[][][][][]⎪⎩⎪⎨⎧+-+-+-=+-+-+-==+++=+++=∴+-+-+-==∑=332212033322120333221203332212033,3)1(3)1(3)1()()1(3)1(3)1()(64.8012.69 72216064.0120120288.09648432.000216.0 )4.0()4.0(8.1)6.0(2.1)6.0()4.0()1(3)1(3)1()()(y t y t t y t t y t t y x t x t t x t t x t t x P P P P P P t P t t P t t P t t B P t P i i i习题3-5 设一条三次B ézier 曲线的控制顶点为P 0,P 1,P 2,P 3。
对曲线上一点P (0.5),及一个给定的目标点T ,给出一种调整B ézier 曲线形状的方法,使得P (0.5)精确通过点T 。
抛物线扫描转换的研究与实现汪丽娟【摘要】在中点画圆法的基础上设计出了一种中点转换算法,实现了抛物线的直接绘制,并对算法效率进行了分析,在实现快速绘制抛物线时产生了良好的效果.%A midpoint conversion algorithm is designed on the basis of the midpoint drawcircle to achieve the direct rendering of the parabola,and the efficiency of the algorithm is analyzed to achieve quick parabolic drawing.【期刊名称】《兰州工业学院学报》【年(卷),期】2012(019)003【总页数】3页(P35-37)【关键词】抛物线;扫描转换;中点转换法【作者】汪丽娟【作者单位】广西外国语学院信息工程学院,广西南宁,530222【正文语种】中文【中图分类】O211.670 引言现今大部分软件都直接实现了画线、画圆、画矩形等基本图形程序,但却没有实现直接画抛物线的程序,虽然可以用其他的方法来替代画抛物线,但对于经常用到抛物线的工程制图人员来说是很不方便的,因此,如果提供一个方便快捷的画抛物线算法,将会给很多工程制图人员受益.据此,作者对中点画圆法进行了深入地分析,受其启发,提出了抛物线的扫描转换算法——中点转换法,并对它进行了粗略的分析,为进行抛物线的绘制提供一定的思路.1 算法原理通过现有的数学知识,我们知道抛物线是轴对称图形,所以,只要能够生成1/2抛物线的图形,那么另一半我们就可以通过轴对称变换而得到.这里,我们只考虑抛物线的顶点在原点时右半象限的情况,对于顶点不在原点的抛物线,可先通过平移变换,化为顶点在原点的抛物线,在进行扫描转换,把所得的像素坐标加上一个位移量即得所求的像素坐标.抛物线的方程为:y = ax2,其中a决定了开口的方向和开口的大小.当a<0时,抛物线F(x, y)的开口向y轴的正方向,a越大,则抛物线的开口越大;当a>0时,抛物线F(x, y)的开口向y轴的负方向,a越小,则抛物线的开口越大;当a=0时,y=0,此时就是y轴.若抛物线的顶点在原点,开口方向向上,假定x坐标为xp的所有像素中与该圆弧最近者已确定,记为P(xp, yp),那么,下一个像素只能是正上方的P1(xp, yp+1)或右上方的P2(xp+1,yp+1)两者之一.如图1所示.图1 开口向上抛物线可构造函数[1]F(x, y) = ax2-y.(1)对于抛物线上的点,有F(x, y)=0;对于抛物线外的点,F(x, y)>0;对于抛物线内的点满足F(x, y)<0.假设M是P1和P2的中点,即M=(xp+0.5, yp+1).那么,当F(M)>0时,M在抛物线外,这说明P1距离抛物线更近,应取P1作为下一个像素;当F(M)<0时,M在抛物线内,这说明P2距离抛物线更近,应取P2作为下一个像素;当F(M)=0时,M在抛物线上,在P1和P2之中随便去一个就可以,可约定取P1.此时,可构造判别式[2]d=F(M)=F( xp+0.5, yp+1)=a( xp+0.5) 2 - (yp+1).(2)若d>0,则应取P1为下一像素,而且在下一个像素的判别式为d=F( xp+0.5, yp+2)=a( xp+0.5) 2 - (yp+2)=d-1.(3)所以,沿正上方向,d的增量为-1.而若d≤0,则应取P2为下一像素,而且在下一个像素的判别式为d=F( xp+1.5, yp+2)=a( xp+1.5)2-(yp+2)=d + a(2xp+1.5)-1.(4)所以,沿右上方向,d的增量为a(2xp+1.5)-1.由于此时抛物线的顶点在原点,因此,第一像素是(0, 0),判别式d的初始值是d=F(0.5, 1)=0.52 a-1=0.25 a-1.对于顶点在原点,开口方向向下的抛物线则如图2所示:图2 开口向下抛物线此时,M的坐标为( xp+0.5, yp-1),P1和P2的取法约定与以上讨论一样,构造判别式d=F(M)=F(xp+0.5, yp-1)=a(xp+0.5) 2-(yp-1).(5)若d>0,则应取P1为下一像素,而且在下一个像素的判别式为[3]d=F( xp+0.5, yp-2)=a( xp+0.5) 2 - (yp-2)=d + 1.(6)所以,沿正下方向,d的增量为1.而若d≤0,则应取P2为下一像素,而且在下一个像素的判别式为d=F( xp+1.5, yp-2)=a(xp+1.5) 2-(yp-2)=d + a(2 xp+1.5) +1.(7)所以,沿右下方向,d的增量为a(2 xp+1.5)+1.此时抛物线的顶点在原点,因此,第一像素是(0, 0),判别式d的初始值是d=F(0.5, -1)=0.52 a-(-1)=0.25 a+1.2 算法设计根据以上原理,以开口向上的抛物线为例,可设计出如下算法[4-5](用伪码表示) Parabola (float a, int h, int k){int x=0, y=0;float d=a+0.5;drawPixel(h, k);while (1){if (d < 0){d+=a*(2*x + 1.5)-1;x++;y++;}else{d-=1;y++;}drawPixel(x, y);if (x到边界值或y到边界值)break;}}伪码程序中a即为抛物线函数中的a,决定着抛物线的开口方向,h是抛物线顶点的横坐标值,k是抛物线顶点的纵坐标值.程序先绘制出顶点坐标,再根据条件一个点一个点的绘制出整条抛物线.3 算法分析算法运行结果如下:图3 运算结果该算法的运行时间在0.001 s左右,生成抛物线图像的速度较快,比较适合于软件上实现绘制抛物线的图形.若我们把a的输入只限定在整数范围内,则可把算法中的浮点数去掉,使整个算法均为整数运算,可以让算法的效率得到进一步提高.例如,可以令e=4d,其他有关d的式子也可将d换成e,从而去掉浮点数运算.同时,若考虑到每当x递增1,d递增△x=2a,每当y递增1,d递减△y=1,而使算法效率得到提高.根据以上算法的研究改进,算法的效率可以比以前有一定的提高,使算法更符合实际的应用需求,在实际应用过程中获得更好的效果.4 结语通过对中点画圆法的深入研究,并对其进行相应的改进,提出了可用于绘制抛物线的算法,该算法的原理容易理解,程序编写简单快捷,符合工程制图人员的需求,适合于快速实现抛物线绘制时采用.参考文献:[1] 孙家广,胡事民. 计算机图形学[M]. 北京:清华大学出版社, 1998.[2] 王汝传. 计算机图形学[M]. 北京:人民邮电出版社, 2002.[3] 青野雅树.Java的计算机图形学[M].张文乐,译.北京:科学出版社, 2004.[4] 梁立新. 项目实践精辟:Java核心技术应用开发[M]. 北京:电子工业出版社,2007:30-40.[5] 李律松,马传宝,李婷.数据库开发与实例[M].北京:清华大学出版社,2006.。