Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 14.8 Three-Dimensional Object Representations

Similar presentations


Presentation on theme: "Chapter 14.8 Three-Dimensional Object Representations"— Presentation transcript:

1 Chapter 14.8 Three-Dimensional Object Representations
贝塞尔曲线 2018/12/7 交通运输学院CAD/CAM研究所

2 Bézier曲线和曲面 法国工程师Bézier使用逼近样条为雷诺汽车公司设计汽车外形而开发。数学基础简单,容易实现
Bézier样条在各种CAD系统、大多数图形系统、相关绘图和图形软件包中有广泛应用 广泛应用于CAD、3DMax等图形开发工具中

3 Bézier Curves定义 控制点: pk=(xk, yk, zk) , k=0,1,···n. 构造P(u)
Bk,n(u) 是Bernstein (伯恩斯坦)函数: C(n, k) 是二项式系数 : Bernstein basis Prescribed: 00=1, 0!=1.

4 Vector equation

5 两点创建1次Bezier曲线 n=1, 矩阵方程: P0 到P1直线。 2018/12/7 交通运输学院CAD/CAM研究所

6 The Two First Degree Blending Functions
1次Bernstein 函数 2018/12/7 交通运输学院CAD/CAM研究所

7 3点创建2次Bezier曲线 When n=2, The matrix form is: And:
This is a parabola(抛物线) starting at P0 and ending at P1. And: 2018/12/7 交通运输学院CAD/CAM研究所

8 Blending Functions and the Curve Examples
2次Bernstein 函数 2018/12/7 交通运输学院CAD/CAM研究所

9 3次 Bézier Curves Four points can specifying a cubic Bézier curve.
P(t) = B0,3P0 + B1,3P1 + B2,3 P2 +B3,3P3 = (1-t)3P0 + 3t(1-t)2P1 + 3t2(1-t)P2 + t3P (0  t  1) 2018/12/7 交通运输学院CAD/CAM研究所

10 3次 Bézier Curves矩阵表达式 P(t) = (1-t)3P0 + 3t(1-t)2P1 + 3t2(1-t)P2 + t3P3
2018/12/7 P(t) = (1-t)3P0 + 3t(1-t)2P1 + 3t2(1-t)P2 + t3P3 交通运输学院CAD/CAM研究所

11 代数形式 That is: 2018/12/7 交通运输学院CAD/CAM研究所

12 two points generate a straight line, three points generate a parabola,
As a rule, a Bézier Curve is a polynomial of degree one less than the number of control points used: two points generate a straight line, three points generate a parabola, four points a cubic curve, and so forth. Uk Un-k

13 重要 试从Bèzier曲线的定义式写出三次Bèzier曲线的矩阵表示。(本题15分,只写出结果者得2分)
已知Bezier曲线特征多边形的顶点P0(1,2)、P1(3,4)、P2(5,5)、P3(7,3),求Bezier曲线的参数方程P(t)(矩阵表示);计算 t=0.5,曲线上点P(0.5) Uk Un-k 2018/12/7 交通运输学院CAD/CAM研究所

14 Examples prog8BezierCurve.exe 2018/12/7 交通运输学院CAD/CAM研究所

15 Bézier Curves的性质 掌握 Endpoint Interpolation(端点插值)
Affine Invariance(仿射不变性) Convex-hull Property(凸包性) Linear Precision(线性) Variation-diminishing Property(变差缩减性) Derivativesof Bézier Curves(导数) 2018/12/7 交通运输学院CAD/CAM研究所

16 端点插值Endpoint Interpolation
A Bézier Curve dose not generally pass through, or interpolate, all of the control points, but it always interpolates the first and the last point. 2018/12/7 交通运输学院CAD/CAM研究所

17 Affine Invariance (仿射不变性)
Q0 Q3 Q1 Q2 P0 P3 P2 P1 2018/12/7 交通运输学院CAD/CAM研究所

18 Convex-hull Property (凸包性)
A Bézier Curve never wanders outside its convex hull. 2018/12/7 交通运输学院CAD/CAM研究所

19 Linear Precision(线性) If all of the control points are placed in a straight line, their convex hull collapses(压缩) to a line. The Bézier Curve is therefore “trapped” inside this hull and so must also be a straight line. 2018/12/7 交通运输学院CAD/CAM研究所

20 Variation-diminishing Property (变差缩减性)
2018/12/7 交通运输学院CAD/CAM研究所

21 Derivatives of Bézier Curves导数
The first derivative of a Bézier Curve is So the velocity(the first derivative) is another Bézier Curve, built on a new set of control vectors pk. 2018/12/7 交通运输学院CAD/CAM研究所

22 When t=0, t=1, one can evaluate the derivatives at the starting point and the ending point:
Thus, the slope at the beginning of the curve is along the line joining the first two control points, and the slope at the end is along the line joining the last two endpoints. 2018/12/7 交通运输学院CAD/CAM研究所

23 因此,曲线在起点处的切线方向是第一第二控制点的连线,长度是其n倍;曲线在终点处的切线方向是倒数第二第一控制点的连线,长度是其n倍。
端点的二阶导数取决于与其最靠近的三个控制点,与其他点无关。 事实上,r阶导矢只与(r+1)个相邻点有关,与更远点无关。 2018/12/7 交通运输学院CAD/CAM研究所

24 使用Bézier Curves设计 Closed Bézier curve(封闭)
To pass closer to a given point(靠近曲线) Piecing lower degree Bézier curve sections (Bezier曲线拼接) 2018/12/7 交通运输学院CAD/CAM研究所

25 Closed Bézier curve 2018/12/7 交通运输学院CAD/CAM研究所

26 To Pass Closer to Given Point
2018/12/7 交通运输学院CAD/CAM研究所

27 Bezier曲线拼接 G0: Pn= Q0; (ai= Pi- Pi-1 bj= Qj- Qj-1)
G1: b1=an , that is, Pn-1 , Pn= Q0 , Q1are collinear. C1: b1=an , that is, Pn= Q0 and Q1= Pn +(Pn- Pn-1). C2: based on C1, and Q2= Pn-2 +4(Pn- Pn-1). 2018/12/7 交通运输学院CAD/CAM研究所

28 Chapter 14.9 Three-Dimensional Object Representations
贝塞尔曲面(Bézier Surfaces) 2018/12/7 交通运输学院CAD/CAM研究所

29 张量积Bezier曲面定义 With pj,k specifying the location of the (m+1) by (n+1) control points. 2018/12/7 交通运输学院CAD/CAM研究所

30 Matrix Form 2018/12/7 交通运输学院CAD/CAM研究所

31 Example Bézier Surface constructed for m=2, n=2. prog8Beziersurf.exe
2018/12/7 交通运输学院CAD/CAM研究所

32 Bézier Surfaces Have the Same Properties as Bézier Curves.
Double cubic Bézier surface patch and its boundary 10 P 20 01 11 21 31 02 22 12 32 13 23 00 ) , ( = 30 1 03 33 u v 2018/12/7 交通运输学院CAD/CAM研究所

33 用Open GL画Bezier曲线 Bezier曲线由以下函数定义:
void glMap1{fd}(GLenum target, TYPEu1, TYPEu2, GLint stride, GLint order, const TYPE*points); GLenum target,枚举型变量,指定控制点维数:GL_MAP1_VERTEX_3、GL_MAP1_VERTEX_4。 TYPEu1、TYPEu2,指定参数的最小、最大值。 const TYPE*points,指向控制点数组的指针。 GLint stride,指出在数组const TYPE*points中,从一个控制点到下一个控制点之间的数据个数(位移量)。 GLint order,控制点个数,即Bezier曲线的阶数,多项式次数+1。 2018/12/7 交通运输学院CAD/CAM研究所

34 例子: 定义了Bezier曲线后,进行计算之前,需用target的值为参数调用glEnable()激活(glDisable() 取消)。
用以下函数计算曲线上的点: void glEvalCoord1{fd}{v}(TYPE u); TYPE u的取值在TYPEu1、TYPEu2之内。 该函数会将参数规范化。 例子: 源代码 运行 2018/12/7 交通运输学院CAD/CAM研究所

35 定义并激活贝塞尔曲线后,亦可用定义网格(Grid,均匀间隔坐标)的方式在参数区间均匀取值计算曲线上点的坐标。 定义一维网格:
void glMapGrid1{fd}(GLint n, TYPEu1, TYPEu2); GLint n,参数的均匀分割数。 一维求值并绘制曲线: void glEvalMesh1(GLenum mode, GLint p1, GLint p2); GLenum mode,取值GL_POINT或GL_LINE,画点或划线。 GLint p1、 GLint p2,参数的对应范围。 2018/12/7 交通运输学院CAD/CAM研究所

36 用Open GL画Bezier曲面 Bezier曲面由以下函数定义:
void glMap2{fd}(GLenum target, TYPEu1, TYPEu2, GLint ustride, GLint uorder, TYPEv1, TYPEv2, GLint vstride, GLint vorder, TYPE *points); GLenum target,枚举型变量,指定控制点维数: GL_MAP1_VERTEX_3、GL_MAP1_VERTEX_4 。 TYPEu1、TYPEu2, TYPEv1、 TYPEv2指定参数u和v的最小、最大值。 const TYPE*points,指向控制点数组的指针。 GLint ustride、 GLint vstride,分别指出在数组const TYPE*points中,从一个控制点到下一个控制点之间的数据个数(位移量)。 GLint uorder、 GLint vorder ,分别指出两个方向的控制点个数,即其各自的阶数,多项式次数+1。 2018/12/7 交通运输学院CAD/CAM研究所

37 例子: 定义了Bezier曲面后,进行计算之前,需用target的值为参数调用glEnable()激活(glDisable() 取消)。
用以下函数计算曲面上的点: void glEvalCoord2{fd}{v}(TYPE u, TYPE v); TYPE u、 TYPE v的取值分别在TYPEu1、TYPEu2和TYPEv1, TYPEv2之内。 该函数会将参数规范化。 例子: 源代码 运行 2018/12/7 交通运输学院CAD/CAM研究所

38 定义并激活贝塞尔曲面后,亦可通过定义网格(Grid,均匀间隔坐标)的方式在参数区间均匀取值计算曲面上点的坐标。 定义二维网格:
void glMapGrid2{fd}(GLint nu, TYPEu1, TYPEu2, GLint nv, TYPEv1, TYPEv2); GLint nu、 GLint nv ,参数的均匀分割数。 二维求值并绘制曲面: void glEvalMesh2(GLenum mode, GLint p1, GLint p2, GLint q2, GLint q2); GLenum mode,取值GL_POINT或GL_LINE,画点或划线。 GLint p1、 GLint p2和GLint q2、 GLint q2是参数的对应范围。 例子 代码 运行 2018/12/7 交通运输学院CAD/CAM研究所

39 2018/12/7 交通运输学院CAD/CAM研究所

40 附录1:知识扩展 Bernstein 函数递归计算 2018/12/7 交通运输学院CAD/CAM研究所

41 附录1:知识扩展 Bernstein 函数递归计算 2018/12/7 交通运输学院CAD/CAM研究所

42 Bezier曲线的DeCasteljau递归计算

43 已知Bezier曲线特征多边形的顶点P0(1,2)、P1(3,4)、P2(5,6)、P3(7,8),求Bezier曲线的参数方程P(t)上t=0.5点
2018/12/7 交通运输学院CAD/CAM研究所


Download ppt "Chapter 14.8 Three-Dimensional Object Representations"

Similar presentations


Ads by Google