OpenCascade Ruled Surface

eryar@163.com

Abstract. A ruled surface is formed by moving a line connecting points of equal relative arc length or equal relative parametric value on two parametric curves from a start point to a terminate point on the curves. The paper focus on the ruled surface in opencascade.

Key words. OpenCascade, Ruled Surface,

1.Introduction

《解析几何》中有关于直纹面Ruled Surface的定义:一曲面S称为直纹面,如果存在一族直线使得这一族中的每一条直线全在S上。并且S上的每个点都在这一族的某一条直线上。这样一族直线称为S的一族直母线。其参数方程为:

即可以将直纹面看作是曲面对当v=0和1时得到的两个边界曲线之间进行线性插值得到的曲面。

Autodesk 3DS Max中的直纹面,图片来自:

https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/3DSMax/files/GUID-364FE529-431B-448A-850B-DD9BBECAC90B-htm.html

直纹面是从两条曲线来构造曲面的方法,Coons曲面是由四边条界曲线来构造曲面,理解直纹面的构造原理,为进一步理解通用的放样Sweep造型打下基础。

2.Ruled Surface Parametric Equation

直纹面的参数方程也可以写成如下形式:

直接根据参数方程可以定义出相应的直纹面。在OpenCASCADE中话,可以从Geom_Surface派生新的类,并实现相应的虚函数。如实现计算对应参数u,v的值的虚函数D0()等。为了简单起见,用相应的函数计算直纹面上的点,并生成OpenCASCADE Draw Test Harness的命令脚本文件,方便在Draw中可视化。

如有名的Mobius Strip也是个直纹面:

Mobius Strip的参数方程为:

根据上述参数方程在OpenCASCADE的Draw生成Mobius Strip,代码如下所示:

const Standard_Real MOBIUS_RADIUS = 50.0;

void MobiusStrip(Standard_Real theU, Standard_Real theV, gp_Pnt& thePoint)

{

thePoint.SetX((MOBIUS_RADIUS + theU * Cos(0.5 * theV)) * Cos(theV));

thePoint.SetY((MOBIUS_RADIUS + theU * Cos(0.5 * theV)) * Sin(theV));

thePoint.SetZ(theU * Sin(0.5 * theV));

}

void TestMobiusStrip()

{

std::ofstream aTclFile("d:/mobius.tcl");

aTclFile << "pload ALL" << std::endl;

aTclFile << "vinit" << std::endl;

Standard_Real aWidth = 10.0;

Standard_Integer aN = 0;

for (Standard_Real s = -aWidth; s < aWidth; s += 1.0)

{

aTclFile << "polyline p" << ++aN ;

for (Standard_Real t = 0.0; t < M_PI * 2.0; t += 0.01)

{

gp_Pnt aPoint;

MobiusStrip(s, t, aPoint);

aTclFile << " " << aPoint.X() << " " << aPoint.Y() << " " << aPoint.Z();

}

aTclFile << "\n vdisplay p" << aN << std::endl;

}

for (Standard_Real t = 0.0; t < M_PI * 2.0; t += 0.2)

{

aTclFile << "polyline p" << ++aN;

gp_Pnt aPoint;

MobiusStrip(-aWidth, t, aPoint);

aTclFile << " " << aPoint.X() << " " << aPoint.Y() << " " << aPoint.Z();

MobiusStrip(aWidth, t, aPoint);

aTclFile << " " << aPoint.X() << " " << aPoint.Y() << " " << aPoint.Z();

aTclFile << "\n vdisplay p" << aN << std::endl;

}

}

int main(int argc, char* argv[])

{

TestMobiusStrip();

return 0;

}

在D盘生成一个mobius.tcl脚本文件,直接在Draw Test Harness中输入命令:

source d:/mobius.tcl

即可得到如下图所示的Mobius环:

其他的直纹面只要知道参数方程,都可以采用这种方法在OpenCASCADE Draw Test Harness中进行显示。有人也用POV-Ray根据直纹面的参数方程来绘制直纹面,效果更不错。

这是使用参数方程来表示直纹面的方法,如果知道直纹面的参数方程,可以从几何曲面来派生新类Geom_Surface,并实现几个相关虚函数,应该可以直接给OpenCASCADE显示了,这种方法没有测试。

3.Ruled Surface to B Spline Surface

如果已知直纹面的参数方程,如何用NURBS曲面来表示直纹面呢?在《非均匀有理B样条》一书中给出了一种将给定两条曲线C1,C2转换成直纹面的方法。他给出的限制条件是想要生成在v方向是直线的曲面,即是C1(u)和C2(u)之间的线性插值。而且还要求在两条曲线的等参数点之间进行插值。又由于曲面是张量各曲面,两条边界曲线C1和C2必须具有相同的次数,并定义在相同的节点矢量上,因此表示这样的直纹面的B样条转换过程为:

l 确保两条曲线定义在相同的参数区间内;

l 确保两条曲线的次数相同。如果不同,则将次数低的曲线升阶;

l 确保两条曲线有相同的节点矢量。

OpenCASCADE中生成直纹面的是类GeomFill的静态函数Surface(),其实现步骤与上述类似,具体实现的类是GeomFill_Profiler。GeomFill_Profiler是个更通用的类,它可以根据多条曲线来构造曲面。下面通过Draw Test Harness脚本来根据两条曲线构造直纹面。

3.1 根据两条直线构造直纹面

# Ruled surface between two lines.

vertex v1 0 0 0

vertex v2 0 8 8

vertex v3 8 0 8

vertex v4 8 8 0

edge e1 v1 v2

edge e2 v3 v4

pruled r1 e1 e2

vdisplay v1 v2 v3 v4 e1 e2 r1

生成直纹面是一个双线性曲面,如下图所示:

3.2 根据两个圆构造直纹面

# Ruled surface between circle and ellipse.

circle c1 0 0 0 5

circle c2 0 0 10 4

mkedge e3 c1

mkedge e4 c2

pruled r2 e3 e4

vdisplay e3 e4 r2

生成的直纹面是一个圆锥面,效果如下图所示:

当顶部的圆旋转时会得到如下图所示的直纹面:

相应的Draw脚本如下:

# Ruled surface between circle and ellipse.

circle c1 0 0 0 5

circle c2 0 0 10 4

mkedge e3 c1

mkedge e4 c2

pruled r2 e3 e4

vdisplay e3 e4 r2

wait 2

trotate e4 0 0 0 0 0 1 30

pruled r2 e3 e4 

vdisplay r2

wait 2

trotate e4 0 0 0 0 0 1 30

pruled r2 e3 e4 

vdisplay r2

wait 2

trotate e4 0 0 0 0 0 1 30

pruled r2 e3 e4 

vdisplay r2

生成的动画效果如下图所示:

4.Conclusion

根据直纹面的参数方程就可以绘制出相应的曲面,然后如何用B样条曲面来表示直纹面,需要满足一定的条件。IGES中定义的直纹面就给出了两种方式:等弧长和等参数构造。引用《非均匀有理B样条》书中对两种形式的说明如下:一般情况下,连接两条曲线上相对弧长相等的点会产生一个几何上不同的曲面,而这样的曲面不能通过NURBS来表示。因此,要在NURBS的直纹面和IGES的直纹面(Type 118 Form 0/1)之间进行数学上的精确转换是不可能的。

OpenCASCADE的直纹面也是使用的NURBS表示,所以其也是等参数形式的直纹面。希望在理解根据两条曲线来构造曲面的方法来理解更一般的造型算法,即通过多条曲线来构造曲面的造型方法。

5.References

1. Weisstein Eric W. “Ruled Surface”. http://mathworld.wolfram.com/RuledSurface.html

2. www.ms.uky.edu/~lee/visual05/gallery/ruledsurfaces.doc

3. The Initial Graphics Exchange Specification (IGES) Version 6.0

4. 赵罡, 穆国旺, 王拉柱. 非均匀有理B样条. 清华大学出版社. 2010

5. 丘维声. 解析几何. 北京大学出版社. 1996

OpenCascade Ruled Surface的更多相关文章

  1. OpenCASCADE Linear Extrusion Surface

    OpenCASCADE Linear Extrusion Surface eryar@163.com Abstract. OpenCASCADE linear extrusion surface is ...

  2. Mesh Algorithm in OpenCascade

    Mesh Algorithm in OpenCascade eryar@163.com Abstract. Rendering a generic surface is a two steps pro ...

  3. OpenCASCADE Face Normals

    OpenCASCADE Face Normals eryar@163.com Abstract. 要显示一个逼真的三维模型,其顶点坐标.顶点法向.纹理坐标这三个信息必不可少.本文主要介绍如何在Open ...

  4. Open CASCADE Technology: IGES Support

    2015/6/4 Open CASCADE Technology: IGES Support http://www.opencascade.org/doc/occt­6.7.0/overview/ht ...

  5. <<Differential Geometry of Curves and Surfaces>>笔记

    <Differential Geometry of Curves and Surfaces> by Manfredo P. do Carmo real line Rinterval I== ...

  6. <Differential Geometry of Curves and Surfaces>(by Manfredo P. do Carmo) Notes

    <Differential Geometry of Curves and Surfaces> by Manfredo P. do Carmo real line Rinterval I== ...

  7. 3DSMAX中英文对比大全(从A-Z分类)

    A Absolute Mode Transform Type-in绝对坐标方式变换输入 Absolute/Relative Snap Toggle Mode绝对/相对捕捉开关模式 ACIS Optio ...

  8. Surface Normal Vector in OpenCascade

    Surface Normal Vector in OpenCascade eryar@163.com 摘要Abstract:表面上某一点的法向量(Normal Vector)指的是在该点处与表面垂直的 ...

  9. Geometry Surface of OpenCascade BRep

    Geometry Surface of OpenCascade BRep eryar@163.com 摘要Abstract:几何曲面是参数表示的曲面 ,在边界表示中其数据存在于BRep_TFace中, ...

随机推荐

  1. Tomcat启动慢解决方法(本人CentOS7.4系统)

    首先查看日志信息,查看因为什么而启动慢 在CentOS7启动Tomcat时,启动过程很慢,需要几分钟,经过查看日志,发现耗时在这里:是session引起的随机数问题导致的.Tocmat的Session ...

  2. hadoop多文件格式输入

    版本号: CDH5.0.0 (hdfs:2.3.mapreduce:2.3,yarn:2.3) hadoop多文件格式输入,一般能够使用MultipleInputs类指定不同的输入文件路径以及输入文件 ...

  3. UVA 12009 - Avaricious Maryanna(数论)

    UVA 12009 - Avaricious Maryanna 题目链接 题意:给定一个n.求出n个数位组成的数字x,x^2的前面|x|位为x 思路:自己先暴力打了前几组数据,发现除了1中有0和1以外 ...

  4. 我的Java开发学习之旅------&gt;Base64的编码思想以及Java实现

    Base64是一种用64个字符来表示随意二进制数据的方法. 用记事本打开exe.jpg.pdf这些文件时,我们都会看到一大堆乱码,由于二进制文件包括非常多无法显示和打印的字符.所以,假设要让记事本这种 ...

  5. [源码]解析 SynchronousQueue 上界,下界.. 数据保存和数据传递. 堵塞队列. 有无频繁await?

     简析SynchronousQueue.LinkedBlockingQueue(两个locker,更快),ArrayBlockingQueue(一个locker,读写都竞争)     三者都是bloc ...

  6. 新ITC提交APP常见问题与解决方法(Icon Alpha,Build version,AppIcon120x120)(2014-11-17)

    1)ICON无法上传.提示图片透明(有Alpha通道) 苹果如今不接受png里的Alpha了.提交的图标带有Alpha通道就提示: watermark/2/text/aHR0cDovL2Jsb2cuY ...

  7. 基于ASP.MVC票据FormsAuthenticationTicket身份认证

    做一个最基础的业务需求用户登录,将此用户的身份发回到客户端的Cookie,之后此用户再访问这个web应用就会连同这个身份Cookie一起发送到服务端.服务端上的授权设置就可以根据不同目录对不同用户的访 ...

  8. gulp的基本用法

    这几天简单的研究了一下gulp的用法,gulp对于初学者来说还是很友好的. 官方给出gulp的优点如下: 1.通过代码优于配置的策略,Gulp 让简单的任务简单,复杂的任务可管理. 2.Gulp 严格 ...

  9. .NET Core RSA 签名和验签(密钥为 16 进制编码)

    使用 OpenSSL 生成公私钥对,命令: $ openssl genrsa -out rsa_1024_priv.pem $ openssl pkcs8 -topk8 -inform PEM -in ...

  10. 【转载】Java 类加载与初始化

    原文地址:http://www.cnblogs.com/zhguang/p/3154584.html 目录 类加载器 动态加载 链接 初始化 示例 类加载器 在了解Java的机制之前,需要先了解类在J ...