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中, ...
随机推荐
- 【Struts2的执行流程,这个博主写的很详细】
http://blog.csdn.net/wjw0130/article/details/46371847
- Property list types and their various representations
iOS下Property list能够存储的数据类型 Property list types and their various representations Abstract type XML ...
- 【SqlServer】【问题收集】必须声明标量变量
1 问题概述 在DAL层,通过标量给变量赋值时,出现如下异常 我们来看看在数据访问层的SQL语句: //根据EmployeeName条件获取数据 public DataTable GetEmplo ...
- Array的基本操作
准备饿补基础技术,先来个数组的总结. 1 .合并操作 concat : var C = A.concat(B); 用A数组合并B数组,生成新的C数组. 循环插入 ...
- ABP 框架启程
准备动手写一套电商的系统,辗转收集了不少相关的开源项目,最后决定使用ABP作为起点. 在园子里好多人都在推广ABP.有个园友做了一个集合贴,方便大家使用 ABP集合贴 建议大家优先看 HK Zhan ...
- C#读取XML文件的五个步骤
//1.创建XmlDocument对象 XmlDocument xmlDoc=new XmlDocument(); //2.加载源文件 xmlDoc.Load("文件名.xml" ...
- 将ZIP文件添加到程序集资源文件然后在运行时解压文件
今天做安装打包程序研究,之前同事将很多零散的文件发布成一个安装文件夹给用户,这样体验不好,我希望将所有文件打包成一个.net程序,运行此程序的时候自解压然后执行后续的安装步骤. 解决过程: 1,将所有 ...
- 《C++程序设计语言(十周年纪念版)》【PDF】下载
<C++程序设计语言(十周年纪念版)>[PDF]下载链接: https://u253469.pipipan.com/fs/253469-230382171 内容简介 <C++程序设计 ...
- (五):C++分布式实时应用框架——支撑复杂的业务通讯关系
C++分布式实时应用框架--支撑复杂的业务通讯关系 技术交流合作QQ群:436466587 欢迎讨论交流 版权声明:本文版权及所用技术归属smartguys团队所有,对于抄袭,非经同意转载等行为保留法 ...
- JeeSite如何正确连接SQL SERVER 数据库
JeeSite如何正确连接SQL SERVER 数据库 jeesite介绍 感谢jeesite项目的作者thinkgem. 没有你我也不会更改这数据源非了恁大的劲,,,,嘻嘻嘻说多了. JeeSite ...