飞机数字化建模基础课程设计

上传人:dao****ing 文档编号:66001144 上传时间:2022-03-26 格式:DOCX 页数:17 大小:238.27KB
收藏 版权申诉 举报 下载
飞机数字化建模基础课程设计_第1页
第1页 / 共17页
飞机数字化建模基础课程设计_第2页
第2页 / 共17页
飞机数字化建模基础课程设计_第3页
第3页 / 共17页
资源描述:

《飞机数字化建模基础课程设计》由会员分享,可在线阅读,更多相关《飞机数字化建模基础课程设计(17页珍藏版)》请在装配图网上搜索。

1、飞机数字化建模技术基础学院:航空航天工程学部专业:飞行器制造工程班级:14030102班 学号:2011040301088姓名:赵强实践教学要求 本次实践教学目的: 在理论学习的础上,通过上机编程,进一步理解参数样条曲线、Bezier曲线、B样条曲线的构造方法,强化对课程重点内容的掌握,提高解决实际问题的能力。 实践内容: 1. 编写Bezier曲线、均匀B样条曲线的正向设计程序,即根据给定的控制顶点,得到曲线。 2. 参数样条曲线、 Bezier曲线拟合、均匀B样条曲线拟合三项中任选一项。 要求 1. 可使用C、C+、VB等高级编程语言,最好用VC+. 2. 控制顶点和型值点的输入要支持鼠标

2、和键盘两种输入方式。 3. 要编写实验报告,其中包括软件说明和实验结果。实验结果为程序所构造的 曲线的图片,应尽量美观、个性化,并尽量包含特殊情况的实验结果。 4. 提交内容:可执行程序、源程序(包含必要的注释)、实验报告。均为电子文件。 5. 上交时间:期末考试之前。实验结果程序代码及软件截图一、 Bezier曲线的绘制:Private Sub Command1_Click() 绘图Picture1.DrawWidth = 2Picture1.FontSize = 12Picture1.Scale (-300, 300)-(300, -300)Picture1.Line (-300, 0)-

3、(300, 0)Picture1.Line (0, 300)-(0, -300)Picture1.CurrentX = 270: Picture1.CurrentY = 40: Picture1.Print XPicture1.CurrentX = 15: Picture1.CurrentY = 285: Picture1.Print YPicture1.FontSize = 9For i = -280 To 280 Step 40Picture1.Line (i, 0)-(i, 8)Picture1.CurrentX = i - 12: Picture1.CurrentY = -5: Pic

4、ture1.Print iNext iFor j = -280 To -40 Step 40Picture1.Line (0, j)-(8, j)Picture1.CurrentX = -28: Picture1.CurrentY = j + 10: Picture1.Print jNext jFor j = 40 To 280 Step 40Picture1.Line (0, j)-(8, j)Picture1.CurrentX = -28: Picture1.CurrentY = j + 10: Picture1.Print jNext j Dim px(4) As Double Dim

5、py(4) As Double Dim a1, b1, c1, d1 As Double Dim a2, b2, c2, d2 As Double Dim x, y, u As Double If (Not IsNumeric(Text1) Or Not IsNumeric(Text2) Or Not IsNumeric(Text3) Or Not IsNumeric(Text4) _ Or Not IsNumeric(Text5) Or Not IsNumeric(Text6) Or Not IsNumeric(Text7) Or Not IsNumeric(Text8) Then 规定文本

6、框中输入必须为数字MsgBox 输入错误!Else px(0) = Text1.Text: py(0) = Text2.Text px(1) = Text3.Text: py(1) = Text4.Text px(2) = Text5.Text: py(2) = Text6.Text px(3) = Text7.Text: py(3) = Text8.Text Picture1.FontSize = 18 Picture1.CurrentX = px(0): Picture1.CurrentY = py(0): Picture1.Print P; 0 For i = 0 To 2 Pictur

7、e1.DrawWidth = 1.5 Picture1.Line (px(i), py(i)-(px(i + 1), py(i + 1), vbGreen: Picture1.Print P; i + 1 Next i For i = 0 To 3 Picture1.DrawWidth = 7 Picture1.Line (px(i), py(i)-(px(i) + 1, py(i) - 1) Next i a1 = -px(0) + 3 * px(1) - 3 * px(2) + px(3) b1 = 3 * px(0) - 6 * px(1) + 3 * px(2) c1 = -3 * p

8、x(0) + 3 * px(1) d1 = px(0) a2 = -py(0) + 3 * py(1) - 3 * py(2) + py(3) b2 = 3 * py(0) - 6 * py(1) + 3 * py(2) c2 = -3 * py(0) + 3 * py(1) d2 = py(0) For u = 0 To 1 Step 0.00001 x = a1 * u 3 + b1 * u * u + c1 * u + d1 y = a2 * u 3 + b2 * u * u + c2 * u + d2 If u = 0 Then Picture1.CurrentX = x Pictur

9、e1.CurrentY = y Else Picture1.DrawWidth = 3 Picture1.Line -(x, y), RGB(255, 0, 0) End If Next uEnd IfEnd SubPrivate Sub Command2_Click() 清空文本框中的数据 Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = Text7.Text = Text8.Text = End SubPrivate Sub Command3_Click() 清除Picture上的图P

10、icture1.ClsEnd Sub二、 B样条曲线的绘制:Function f()Picture1.FontSize = 9Picture1.Scale (-900, 1000)-(900, -1000)Picture1.Line (-800, 0)-(800, 0)Picture1.Line (0, 800)-(0, -800)For i = -7 To 7Picture1.Line (100 * i, 0)-(100 * i, 20)Picture1.CurrentX = i * 100 - 50: Picture1.CurrentY = -5: Picture1.Print i * 1

11、00Next iFor i = -7 To -1Picture1.Line (0, 100 * i)-(20, 100 * i)Picture1.CurrentX = -100: Picture1.CurrentY = 100 * i + 20: Picture1.Print i * 100Next iFor i = 1 To 7Picture1.Line (0, 100 * i)-(20, 100 * i)Picture1.CurrentX = -100: Picture1.CurrentY = 100 * i + 20: Picture1.Print i * 100Next iEnd Fu

12、nctionPrivate Sub Form_Load()Picture1.AutoRedraw = TruePicture1.ScaleWidth = 900Picture1.ScaleHeight = 900End SubPrivate Sub command1_Click()绘图If (Not IsNumeric(Text1) Or Not IsNumeric(Text2) Or Not IsNumeric(Text3) Or Not IsNumeric(Text4) _ Or Not IsNumeric(Text5) Or Not IsNumeric(Text6) Or Not IsN

13、umeric(Text7) Or Not IsNumeric(Text8) Then 规定文本框中输入必须为数字MsgBox 输入错误!x0 = Text1.Text: y0 = Text2.TextX1 = Text3.Text: Y1 = Text4.TextX2 = Text5.Text: Y2 = Text6.TextX3 = Text7.Text: Y3 = Text8.TextPicture1.FontSize = 18Picture1.CurrentX = 800: Picture1.CurrentY = -5: Picture1.Print XPicture1.CurrentX

14、 = 10: Picture1.CurrentY = 810: Picture1.Print YFor t = 0 To 1 Step 0.001x = x0 * (1 / 6) * (t * t * t) + X1 * (1 / 6) * (-3 * t * t * t + 3 * t * t + 3 * t + 1) + X2 * (1 / 6) * (3 * t * t * t - 6 * t * t + 4) + X3 * (1 / 6) * (-t * t * t + 3 * t * t - 3 * t + 1)y = y0 * (1 / 6) * (t * t * t) + Y1

15、* (1 / 6) * (-3 * t * t * t + 3 * t * t + 3 * t + 1) + Y2 * (1 / 6) * (3 * t * t * t - 6 * t * t + 4) + Y3 * (1 / 6) * (-t * t * t + 3 * t * t - 3 * t + 1)Picture1.CurrentX = x0 + 10: Picture1.CurrentY = y0 + 10: Picture1.Print p0Picture1.CurrentX = X1 + 10: Picture1.CurrentY = Y1 + 10: Picture1.Pri

16、nt p1Picture1.CurrentX = X2 + 10: Picture1.CurrentY = Y2 + 10: Picture1.Print p2Picture1.CurrentX = X3 + 10: Picture1.CurrentY = Y3 + 10: Picture1.Print p3Picture1.DrawWidth = 2Picture1.Line (x0, y0)-(X1, Y1), vbBluePicture1.Line (X1, Y1)-(X2, Y2), vbBluePicture1.Line (X2, Y2)-(X3, Y3), vbBluePictur

17、e1.DrawWidth = 2Picture1.PSet (x, y), vbRedNext tEnd SubPrivate Sub Command2_Click()清空Picture上的图形Picture1.ClsEnd SubPrivate Sub Command3_Click()清空文本框中的数据Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = Text7.Text = Text8.Text = End Sub三、 三次样条曲线的绘制:Function f()Picture1.Fo

18、ntSize = 9Picture1.Scale (-5, 12)-(12, -5) 定义坐标系Picture1.Line (0, 0)-(11, 0)Picture1.Line (0, 11)-(0, 0)For i = 0 To 10Picture1.Line (i, 0)-(i, 0.3)Picture1.CurrentX = i - 0.2: Picture1.CurrentY = -0.2: Picture1.Print iNext iFor i = 1 To 10Picture1.Line (0, i)-(0.3, i)Picture1.CurrentX = -0.5: Pictu

19、re1.CurrentY = i + 0.2: Picture1.Print iNext iEnd FunctionPrivate Sub Form_Load()Picture1.AutoRedraw = TruePicture1.ScaleWidth = 900Picture1.ScaleHeight = 900End SubPrivate Sub command1_Click() 绘图If (Not IsNumeric(Text1) Or Not IsNumeric(Text2) Or Not IsNumeric(Text3) Or Not IsNumeric(Text4) _ Or No

20、t IsNumeric(Text5) Or Not IsNumeric(Text6) Or Not IsNumeric(Text7) Or Not IsNumeric(Text8) Then 规定文本框中输入必须为数字MsgBox 输入错误!X0 = Text1.Text: Y0 = Text2.TextX1 = Text3.Text: Y1 = Text4.TextX2 = Text5.Text: Y2 = Text6.TextX3 = Text7.Text: Y3 = Text8.Textm0 = Text9.Text: m3 = Text10.Text:Picture1.FontSize

21、 = 18Picture1.CurrentX = 11: Picture1.CurrentY = 0: Picture1.Print XPicture1.CurrentX = -0.4: Picture1.CurrentY = 11: Picture1.Print Yh0 = X1 - X0: h1 = X2 - X1: h2 = X3 - X2: a1 = h0 / (h0 + h1): a2 = h1 / (h1 + h2): b1 = 1 - a1: b2 = 1 - a2:d1 = 3 * (b1 * (Y1 - Y0) / h0 + a1 * (Y2 - Y1) / h1): d2

22、= 3 * (b2 * (Y2 - Y1) / h1 + a2 * (Y3 - Y2) / h2):m1 = (a1 * d2 - 2 * d1 + 2 * b1 * m0 - a1 * a2 * m3) / (a1 * b2 - 4): m2 = (2 * d2 - d1 * b2 + b1 * b2 * m0 - 2 * a2 * m3) / (4 - a1 * b2):For x = X0 To X1 Step 0.001y = (1 + 2 * (x - X0) / h0) * (x - X1) / h0) * (x - X1) / h0) * Y0 + (1 - 2 * (x - X

23、1) / h0) * (x - X0) / h0) * (x - X0) / h0) * Y1 + (x - X0) * (x - X1) / h0) * (x - X1) / h0) * m0 + (x - X1) * (x - X0) / h0) * (x - X0) / h0) * m1:Picture1.DrawWidth = 2Picture1.Line (X0, Y0)-(X1, Y1), vbBluePicture1.Line (X1, Y1)-(X2, Y2), vbBluePicture1.Line (X2, Y2)-(X3, Y3), vbBluePicture1.Draw

24、Width = 2Picture1.PSet (x, y), vbRedNext xFor x = X1 To X2 Step 0.001y = (1 + 2 * (x - X1) / h1) * (x - X2) / h1) * (x - X2) / h1) * Y1 + (1 - 2 * (x - X2) / h1) * (x - X1) / h1) * (x - X1) / h1) * Y2 + (x - X1) * (x - X2) / h1) * (x - X2) / h1) * m1 + (x - X2) * (x - X1) / h1) * (x - X1) / h1) * m2

25、:Picture1.PSet (x, y), vbRedNext xFor x = X2 To X3 Step 0.001y = (1 + 2 * (x - X2) / h2) * (x - X3) / h2) * (x - X3) / h2) * Y2 + (1 - 2 * (x - X3) / h2) * (x - X2) / h2) * (x - X2) / h2) * Y3 + (x - X2) * (x - X3) / h2) * (x - X3) / h2) * m2 + (x - X3) * (x - X2) / h2) * (x - X2) / h2) * m3:Picture

26、1.PSet (x, y), vbRedNext xEnd SubPrivate Sub Command2_Click() 清空Picture上的图形Picture1.ClsfEnd SubPrivate Sub Command3_Click() 清空文本框中的数据 Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = Text7.Text = Text8.Text = Text9.Text = Text10.Text = End Sub实验总结本实验所使用的编程软件是Microsoft Visual Basic 6.0 中文版,通过本次实践使自己对VB编程语言有了更深的了解,同时也巩固了飞机数字化建模这门课程中的相关知识,在理论学习的基础上,通过上机编程,进一步理解了参数样条曲线、Bezier曲线、B样条曲线的构造方法,强化了对课程重点内容的掌握,提高了解决实际问题的能力,可谓一举多得,收获良多,最后也感谢岳老师的耐心指导让我能够顺利的完成本次实践。当然也要感谢伙伴们的积极协助,真心谢谢!

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!