OpenCascade Ruled Surface
OpenCascade Ruled Surface
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中的直纹面,图片来自:
直纹面是从两条曲线来构造曲面的方法,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的更多相关文章
- OpenCASCADE Linear Extrusion Surface
OpenCASCADE Linear Extrusion Surface eryar@163.com Abstract. OpenCASCADE linear extrusion surface is ...
- Mesh Algorithm in OpenCascade
Mesh Algorithm in OpenCascade eryar@163.com Abstract. Rendering a generic surface is a two steps pro ...
- OpenCASCADE Face Normals
OpenCASCADE Face Normals eryar@163.com Abstract. 要显示一个逼真的三维模型,其顶点坐标.顶点法向.纹理坐标这三个信息必不可少.本文主要介绍如何在Open ...
- Open CASCADE Technology: IGES Support
2015/6/4 Open CASCADE Technology: IGES Support http://www.opencascade.org/doc/occt6.7.0/overview/ht ...
- <<Differential Geometry of Curves and Surfaces>>笔记
<Differential Geometry of Curves and Surfaces> by Manfredo P. do Carmo real line Rinterval I== ...
- <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== ...
- 3DSMAX中英文对比大全(从A-Z分类)
A Absolute Mode Transform Type-in绝对坐标方式变换输入 Absolute/Relative Snap Toggle Mode绝对/相对捕捉开关模式 ACIS Optio ...
- Surface Normal Vector in OpenCascade
Surface Normal Vector in OpenCascade eryar@163.com 摘要Abstract:表面上某一点的法向量(Normal Vector)指的是在该点处与表面垂直的 ...
- Geometry Surface of OpenCascade BRep
Geometry Surface of OpenCascade BRep eryar@163.com 摘要Abstract:几何曲面是参数表示的曲面 ,在边界表示中其数据存在于BRep_TFace中, ...
随机推荐
- (一)—Linux安装与硬盘分区
相信很多人对linux充满了喜爱,尤其是技术人员,玩惯了windows更想尝试一下这个系统.关于它的优点多多,当然,你的好你的坏,用过才明白!下面我这个菜鸟也来玩装个玩玩. 我不会那么冲动,上来就把自 ...
- dva + antd + mockjs 实现基础用户管理
1.安装dva-cli npm install dva-cli -g 2.创建应用 dva new dvadashboard [dvadashboard为项目名] 3.安装mockjs ...
- 【DevOps】团队敏捷开发系列--开山篇
随着软件发布迭代的频率越来越高,传统的「瀑布型」(开发-测试-发布)模式已经不能满足快速交付的需求.2009 年左右 DevOps 应运而生,开发运维一体化,通过自动化工具与流程让整个软件开发构建.测 ...
- Ajax中的JSON格式与php传输过程的浅析
在Ajax中的JSON格式与php传输过程中有哪些要注意的小地方呢? 先来看一下简单通用的JSON与php传输数据的代码 HTML文件: <input type="button&quo ...
- [hdu 4869](14年多校I题)Turn the pokers 找规律+拓欧逆元
Turn the pokers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- [开源项目] Android校验库 - FireEye
简单易用的Android校验库. 这是一个简单Android校验库,按配置来验证用户输入的表单信息. 仅仅须要几行代码,就可以验证用户输入,而且将验证错误反馈给用户. 它内置了大量经常使用的验证类型, ...
- 【Jquery】之DOM操作
Questions 本篇文章主要讲解Jquery中对DOM的操作,主要内容如下: 1 内容区 1.1 .addClass() (1).addClass(className) <!DOCT ...
- POST/有道翻译 有bug
1.发现在翻译时地址没有变,那是POST请求. 2.通过fidder抓包工具抓取url 3.对data分析,发现每次salt和sign都在变化. 4.查看源码,先用站长工具http://tool.ch ...
- Python的类(class)
python 3.6 官方文档 https://docs.python.org/3.6/index.html python 3.6 的类 https://docs.python.org/3.6/tu ...
- requireJS基础使用
index.html <body class="requireBODY" id="body"><div id="vuebox&quo ...