读取Adobe illustrator导出dxf的样条曲线_第1页
读取Adobe illustrator导出dxf的样条曲线_第2页
读取Adobe illustrator导出dxf的样条曲线_第3页
读取Adobe illustrator导出dxf的样条曲线_第4页
读取Adobe illustrator导出dxf的样条曲线_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

从 dxf 文件里面的 SPLINE 后面有很多相关信息 比如 节点 控制点 拟合点 权值 但是这如何确定 SPLINE 的图形呢 其实 SPLINE 和 CIRCLE 是类似的 Dxf 文件的 CIRCLE 字段后面我们可以读出圆心和半径 那么就可以画出圆来 因为圆有方程 可是样条曲线有没有方程呢 肯定有 否则 autocad 怎么显示出来的呢 我开始的时候在想那 SPLINE 的方程是什么呢 有没有专门的学科和书籍去阐述它呢 我首先想到了 计算机图形学 网上找了很多相关书籍 发现有些书有提到 并且给出了方程 但是我后来发现不对 因为上面给出的是均匀 B 样条的 我们这里的是非均匀的 后来我又发现 autocad 的帮助里面说 autocad 里面的样条曲线是 NURBS 非均匀有理 B 样条 搜索 NURBS 最后下载到两本书 英文的 the nurbs book 和 计算机辅助几何设计与非均匀有 理 B 样条 看了一些后发现中文的这本有包含大部分英文的那本 研究了这两本书好多天后发现 1 dxf 里面的 SPLINE 是一个特殊的 NURBS 是分段 bezier 曲线 2 样条曲线的方程是一个叫做 deboor cox 递推公式 3 有两种方法可以得到图形 先求出分段函数的方程或者直接用递推公式算坐标 理论有了个大概了解后就开始用 VC 编程了 编程有两个比较麻烦的地方 1 读 dxf 文件 里面是树形结构 最麻烦的是块的处理 2 处理 SPLINE 字段 就是用节点序列和控制点序列算坐标 我用的是递推公式算坐标的 就是让参数从最小节点值到最大节点值单调变化 根据参数递推出来的点就扫过了样条曲线 最后出来的结果表明 deboor cox 递推可以画出 SPLINE include include include include struct fpoint float x float y data 30 pp float t 40 void init void ReadFile int n void DrawBspline int k int steps int n void Drawline struct fpoint p1 struct fpoint p2 float deboor int k float u int i int swt void ChangeCS float x float y main char flag int n j steps k type stepslimit n 0 j 0 k 3 type 1 steps 100 clrscr printf The deBoor Algorithm n ReadFile printf Please input degree of each piece of curve k 1 6 scanf d while k 6 kstepslimit steps 1 steps stepslimit printf Warning steps is out of range n printf Please input the steps for the calculation 1 d stepslimit scanf d printf Please choose the type of knot 1 periodical 2 nonperiodical scanf d while type 1 printf Warning the type is illegal n printf Please choose the type of knot type 1 2 scanf d do getchar printf Start or not Y N flag getchar if flag n flag N exit 0 while flag n init for j 0 j n j ChangeCS printf Point is f f n data j x data j y if type 1 for j 0 j n k j t j j else for j 0 j k j t j 0 0 for j k 1 j n 1 j t j float j k for j n j n k j t j float n k printf The deBoor Algorithm n printf The NO of control points is d n n printf The degree of each piece of curves is d n k printf The steps of the calculation of each piece of curves are d n steps if type 1 printf The type of knot is periodical n else printf The type of knot is nonperiodical n DrawBspline k steps n for j 0 j n k j printf f t j getch setcolor GREEN for j 0 jx temp1 pp y temp2 n pp pp data fclose fp float deboor int k float u int i int swt float t1 t2 array 30 int j r if swt 0 for j i k j i j array j data j x else if swt 1 for j i k j i j array j data j y for r 1 r k r for j i 1 j i k r 1 j t1 t j k r u t j k r t j 1 t2 1 0 t1 array j 1 t1 array j 2 t2 array j 1 return array i void Drawline struct fpoint p1 struct fpoint p2 line int p1 x int p1 y int p2 x int p2 y void DrawBspline int k int steps int n struct fpoint points 2001 float u int i j point num printf call drawbezier n point num 0 for i k i n 1 i n 1 for j 0 j steps j u t i j t i 1 t i float steps points point num x deboor k u i 0 points point num y deboor k u i 1 point num for j 0 j point num 1 j Drawline points j points j 1 void ChangeCS float x f

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论