前面章节中讲了贝塞尔(Bézier)曲线,而贝塞尔曲面是对其多一个维度的扩展.其公式依然是曲线的公式:

而之所以由曲线变成曲面,是将顶点横向连了再纵向连.

很多计算机图形学的教程都会有贝塞尔曲面的DEMO.而这里,我依然是使用我制定的脚本代码生成贝塞尔曲面.代码中的控制顶点坐标为随机数生成,所以每次生成的曲面图形都不一样.

相关软件参见:数学图形可视化工具,使用自己定义语法的脚本代码生成数学图形.该软件免费开源.QQ交流群: 367752815

二次贝塞尔曲面:

需要生成3*3个控制顶点

vertices = D1: D2:

u = from  to  D1
v = from to D2 ax0 = rand2(-, )
ay0 = rand2(-, )
az0 = rand2(-, )
bx0 = rand2(-, )
by0 = rand2(-, )
bz0 = rand2(-, )
cx0 = rand2(-, )
cy0 = rand2(-, )
cz0 = rand2(-, ) ax1 = rand2(-, )
ay1 = rand2(-, )
az1 = rand2(-, )
bx1 = rand2(-, )
by1 = rand2(-, )
bz1 = rand2(-, )
cx1 = rand2(-, )
cy1 = rand2(-, )
cz1 = rand2(-, ) ax2 = rand2(-, )
ay2 = rand2(-, )
az2 = rand2(-, )
bx2 = rand2(-, )
by2 = rand2(-, )
bz2 = rand2(-, )
cx2 = rand2(-, )
cy2 = rand2(-, )
cz2 = rand2(-, ) ax3 = rand2(-, )
ay3 = rand2(-, )
az3 = rand2(-, )
bx3 = rand2(-, )
by3 = rand2(-, )
bz3 = rand2(-, )
cx3 = rand2(-, )
cy3 = rand2(-, )
cz3 = rand2(-, ) u1 = (-u)*(-u)
u2 = *(-u)*u
u3 = u*u ax = u1*ax0+u2*ax1+u3*ax2
ay = u1*ay0+u2*ay1+u3*ay2
az = u1*az0+u2*az1+u3*az2
bx = u1*bx0+u2*bx1+u3*bx2
by = u1*by0+u2*by1+u3*by2
bz = u1*bz0+u2*bz1+u3*bz2
cx = u1*cx0+u2*cx1+u3*cx2
cy = u1*cy0+u2*cy1+u3*cy2
cz = u1*cz0+u2*cz1+u3*cz2 v1 = (-v)*(-v)
v2 = *(-v)*v
v3 = v*v x = v1*ax+v2*bx+v3*cx
y = v1*ay+v2*by+v3*cy
z = v1*az+v2*bz+v3*cz u = u*
v = v*

三次贝塞尔曲面:

需要生成4*4个控制顶点

vertices = D1: D2:

u = from  to  D1
v = from to D2 ax0 = rand2(-, )
ay0 = rand2(-, )
az0 = rand2(-, )
bx0 = rand2(-, )
by0 = rand2(-, )
bz0 = rand2(-, )
cx0 = rand2(-, )
cy0 = rand2(-, )
cz0 = rand2(-, )
dx0 = rand2(-, )
dy0 = rand2(-, )
dz0 = rand2(-, ) ax1 = rand2(-, )
ay1 = rand2(-, )
az1 = rand2(-, )
bx1 = rand2(-, )
by1 = rand2(-, )
bz1 = rand2(-, )
cx1 = rand2(-, )
cy1 = rand2(-, )
cz1 = rand2(-, )
dx1 = rand2(-, )
dy1 = rand2(-, )
dz1 = rand2(-, ) ax2 = rand2(-, )
ay2 = rand2(-, )
az2 = rand2(-, )
bx2 = rand2(-, )
by2 = rand2(-, )
bz2 = rand2(-, )
cx2 = rand2(-, )
cy2 = rand2(-, )
cz2 = rand2(-, )
dx2 = rand2(-, )
dy2 = rand2(-, )
dz2 = rand2(-, ) ax3 = rand2(-, )
ay3 = rand2(-, )
az3 = rand2(-, )
bx3 = rand2(-, )
by3 = rand2(-, )
bz3 = rand2(-, )
cx3 = rand2(-, )
cy3 = rand2(-, )
cz3 = rand2(-, )
dx3 = rand2(-, )
dy3 = rand2(-, )
dz3 = rand2(-, ) u1 = pow((-u),)
u2 = *pow((-u),)*u
u3 = *u*u*(-u)
u4 = u*u*u ax = u1*ax0+u2*ax1+u3*ax2+u4*ax3
ay = u1*ay0+u2*ay1+u3*ay2+u4*ay3
az = u1*az0+u2*az1+u3*az2+u4*az3
bx = u1*bx0+u2*bx1+u3*bx2+u4*bx3
by = u1*by0+u2*by1+u3*by2+u4*by3
bz = u1*bz0+u2*bz1+u3*bz2+u4*bz3
cx = u1*cx0+u2*cx1+u3*cx2+u4*cx3
cy = u1*cy0+u2*cy1+u3*cy2+u4*cy3
cz = u1*cz0+u2*cz1+u3*cz2+u4*cz3
dx = u1*dx0+u2*dx1+u3*dx2+u4*dx3
dy = u1*dy0+u2*dy1+u3*dy2+u4*dy3
dz = u1*dz0+u2*dz1+u3*dz2+u4*dz3 v1 = pow((-v),)
v2 = *pow((-v),)*v
v3 = *v*v*(-v)
v4 = v*v*v x = v1*ax+v2*bx+v3*cx+v4*dx
y = v1*ay+v2*by+v3*cy+v4*dy
z = v1*az+v2*bz+v3*cz+v4*dz u = u*
v = v*

数学图形之贝塞尔(Bézier)曲面的更多相关文章

  1. 数学图形(1.47)贝塞尔(Bézier)曲线

    贝塞尔曲线又称贝兹曲线或贝济埃曲线,是由法国数学家Pierre Bézier所发现,由此为计算机矢量图形学奠定了基础.它的主要意义在于无论是直线或曲线都能在数学上予以描述. 上一节讲的是高次方程曲线, ...

  2. 数学图形之SineSurface与粽子曲面

    SineSurface直译为正弦曲面.这有可能和你想象的正弦曲线不一样.如果把正弦曲线绕Y轴旋转,得到的该是正弦波曲面.这个曲面与上一节中的罗马曲面有些相似,那个是被捏过的正四面体,这个则是个被捏过正 ...

  3. 数学图形之罗马曲面(RomanSurface)

    罗马曲面,像是一个被捏扁的正四面体. 本文将展示罗马曲面的生成算法和切图,使用自己定义语法的脚本代码生成数学图形.相关软件参见:数学图形可视化工具,该软件免费开源.QQ交流群: 367752815 维 ...

  4. 数学图形之将曲线(curve)转化成曲面管

    在我关于数学图形的博客中,一开始讲曲线的生成算法.然后在最近的章节中介绍了圆环,还介绍了螺旋管以及海螺的生成算法.一类是曲线,一类是环面,为什么不将曲线变成环的图形,毕竟曲线看上去太单薄了,这一节我将 ...

  5. WHY数学图形可视化工具(开源)

    WHY数学图形可视化工具 软件下载地址:http://files.cnblogs.com/WhyEngine/WhyMathGraph.zip 源码下载地址: http://pan.baidu.com ...

  6. 数学图形之Breather surface

    这是一种挺漂亮的曲面图形,可惜没有找到太多的相关解释. In differential equations, a breather surface is a mathematical surface ...

  7. 数学图形之Kuen Surface

    Kuen Surface应该又是一个以数学家名字命名的曲面.本文将展示几种Kuen Surface的生成算法和切图,其中有的是标准的,有的只是相似.使用自己定义语法的脚本代码生成数学图形.相关软件参见 ...

  8. 数学图形之Boy surface

    这是一个姓Boy的人发现的,所以取名为Boy surface.该图形与罗马图形有点相似,都是三分的图形.它甚至可以说是由罗马曲面变化而成的. 本文将展示几种Boy曲面的生成算法和切图,使用自己定义语法 ...

  9. 数学图形之克莱因瓶(klein bottle)

    克莱因瓶是一种内外两面在同一个曲面上的图形. 在数学领域中,克莱因瓶(德语:Kleinsche Flasche)是指一种无定向性的平面,比如二维平面,就没有“内部”和“外部”之分.克莱因瓶最初的概念提 ...

随机推荐

  1. speech模块实现语音识别

    1.pip安装speech.pywin32 pip install speech pip install pywin32 2.例子 #!/usr/bin/python # coding:utf-8 f ...

  2. Codeforces Round #404 (Div. 2) C. Anton and Fairy Tale 二分

    C. Anton and Fairy Tale 题目连接: http://codeforces.com/contest/785/problem/C Description Anton likes to ...

  3. 马士兵hadoop第四课:Yarn和Map/Reduce配置启动和原理讲解

    马士兵hadoop第一课:虚拟机搭建和安装hadoop及启动 马士兵hadoop第二课:hdfs集群集中管理和hadoop文件操作 马士兵hadoop第三课:java开发hdfs 马士兵hadoop第 ...

  4. 关于ConcurrentDictionary的线程安全

    ConcurrentDictionary是.net BCL的一个线程安全的字典类,由于其方法的线程安全性,使用时无需手动加锁,被广泛应用于多线程编程中.然而,有的时候他们并不是如我们预期的那样工作. ...

  5. 向OSG视图Viewer发送消息

    句柄是以下面的方式传递给osgViewer::Viewer的,osgViewer::View.getCamera().setGraphicsContext(osg::GraphicsContext); ...

  6. Wix中注册c#开发的Activex控件

    一.使用regasm.exe将DLL提取出TLB文件 regasm.exe "Tools.HMIBrowserDetector.dll" /tlb 二.使用wix的heat.exe ...

  7. iOS本地化应用程序

    因为使用的是xcode4,应用程序本地化的问题跟以前的版本还是有些不同,在网上找了些资料对于xcode4以上的版本资料还是相对较少,有些最后要通过手动创建文件,这样操作实在是太麻烦,所以经过一个下午的 ...

  8. EBS已安装模块

    /* Formatted on 2018/3/15 11:14:51 (QP5 v5.256.13226.35538) */ SELECT fa.application_short_name , fp ...

  9. Struts2学习笔记——Struts2与Spring整合

      Struts2与Spring整合后,可以使用Spring的配置文件applicationContext.xml来描述依赖关系,在Struts2的配置文件struts.xml来使用Spring创建的 ...

  10. cocos2d-x 3.0 正式版 项目创建

    官方示比例如以下: Example: $ cd cocos2d-x $ ./setup.py $ source FILE_TO_SAVE_SYSTEM_VARIABLE $ cocos new Eng ...