版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、CAD原理实验报告服装 CAD 原理与应用实验报告目录实验报告(一)三点画圆弧-( 02-07 )实验报告(二)两点画圆弧-( 08-12 )实验报告(三)Bezier曲线的绘制 -( 13-17 )实验报告(四)Hermite曲线的绘制 -( 18-22 )1实验报告(五)B 样条曲线的绘制-( 23-27 )实验报告(一)一、 实验题目使用 VB 软件实现三点画圆弧二、 实验目的1 了解服装 CAD 中的常用曲线, 灵活运用理论知识加以运用,实现操作;2 掌握三点画圆弧的基本原理和绘制方法;3 运用 Visual Basic 6.0软件编写程序实现通过三点的控制成功绘制圆弧。三、 实验目的
2、1. 实验原理2已知三个点A (x1 , y1 ),B (x2 , y2 )C(x3 ,y3 )的坐标根据中垂线相交于圆心可以求出圆心(x ,y )的坐标以及半径 r根据圆心以及已知三点的坐标,判断出所画圆弧的起始角,终止角和中间角的正切角度值,进而求出这三个角的角度。比较起始角,终止角和中间角这三点的角度大小,判断出所画圆弧的方向。2源代码VERSION 5.00Begin VB.Form Form1Caption=三点画圆弧 ClientHeight=5835ClientLeft= 120ClientTop=450ClientWidth=8280LinkTopic=Form1ScaleHe
3、ight=5835ScaleWidth=8280StartUpPosition =3 窗口缺省Begin VB.CommandButton Command3Caption=退出 Height=615Left= 6000TabIndex=3Top=4800Width=1455EndBegin VB.CommandButton Command2Caption=取消 Height=6153Left=3360TabIndex=2Top=4800Width=1455EndBegin VB.CommandButton Command1Caption= 画弧 Height=615Left=720TabInd
4、ex=1Top=4800Width=1455EndBegin VB.PictureBox Picture1Height=4335Left=360ScaleHeight=4275ScaleWidth=7515TabIndex=0Top=240Width=7575EndEndAttribute VB_Name = Form1Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalsePrivate pt()
5、 As mypointPrivate Sub Form_Load()ReDim pt(1)End SubPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)Dim s As Integerpt(UBound(pt).x = xpt(UBound(pt).y = yPicture1.Circle (x, y), 15s = Val(UBound(pt)Select Case sCase 1Picture1.Print ACase 2Picture1.Print B
6、4Case 3Picture1.Print CEnd SelectIf UBound(pt) 1 ThenPicture1.Line(pt(UBound(pt)- 1).x,pt(UBound(pt)-1).y)-(pt(UBound(pt).x, pt(UBound(pt).y)End IfReDim Preserve pt(UBound(pt) + 1)End SubPrivate Sub Command1_Click()Dim A1, A2, B1, B2, C1, C2 As SingleDim X0, Y0, r, PI As DoubleDim t1, t2, t3 As Doub
7、leDim t As DoubleA1 = pt(1).x 2 + pt(1).y 2 - pt(3).x 2 - pt(3).y 2A2 = pt(2).x 2 + pt(2).y 2 - pt(3).x 2 - pt(3).y 2B1 = 2 * pt(3).x - 2 * pt(1).xB2 = 2 * pt(3).x - 2 * pt(2).xC1 = 2 * pt(1).y - 2 * pt(3).yC2 = 2 * pt(2).y - 2 * pt(3).yX0 = (A1 * C2 - A2 * C1) / (B2 * C1 - B1 * C2)Y0 = (A1 * B2 - A
8、2 * B1) / (B2 * C1 - B1 * C2)r = Sqr(pt(1).x - X0) * (pt(1).x - X0) + (pt(1).y - Y0) * (pt(1).y - Y0)PI = 4 * Atn(1)t1 = Atn(pt(1).y - Y0) / (pt(1).x - X0)If pt(1).x - X0 0 And pt(1).y - Y0 0 Thent1 = t1ElseIf pt(1).x - X0 0 Thent1 = t1 + PIElseIf pt(1).x - X0 0 And pt(1).y - Y0 0 And pt(2).y - Y0 0
9、 Thent2 = t2ElseIf pt(2).x - X0 0 Then5t2 = t2 + PIElseIf pt(2).x - X0 0 And pt(2).y - Y0 0 Thent2 = t2 + PIElset2 = t2 + 2 * PIEnd IfEnd IfEnd IfIf t1 t3 t2 ThenFor t = t1 To t2 Step 0.001x = X0 + r * Cos(t)y = Y0 + r * Sin(t)Picture1.PSet (x, y)Next tElseIf t2 t1 t3 Thent2 = t2 + 2 * PIFor t = t1
10、To t2 Step 0.001x = X0 + r * Cos(t)y = Y0 + r * Sin(t)Picture1.PSet (x, y)Next tElseIf t3 t2 t1 Thent2 = t2 + 2 * PIFor t = t1 To t2 Step 0.001x = X0 + r * Cos(t)y = Y0 + r * Sin(t)Picture1.PSet (x, y)Next tElseIf t1 t2 t3 Thent1 = t1 + 2 * PIFor t = t2 To t1 Step 0.001x = X0 + r * Cos(t)y = Y0 + r
11、* Sin(t)Picture1.PSet (x, y)Next tElseIf t3 t1 t2 Thent1 = t1 + 2 * PIFor t = t2 To t1 Step 0.001x = X0 + r * Cos(t)y = Y0 + r * Sin(t)Picture1.PSet (x, y)Next tElseIf t2 t3 0 And n 0 Thent1 = t1ElseIf m 0 Thent1 = pi - t1ElseIf m 0 And n 0 And n 0 And j 0 Thent2 = t2ElseIf i 0 Thent2 = pi - t2ElseI
12、f i 0 And j 0 And j 0 ThenIf t1 t2 ThenFor t = t2 To t1 Step 0.000112x = X0 + r * Cos(t)y = Y0 + r * Sin(t)Picture1.PSet (x, y)Next tElse: t1 = t1 + 2 * piFor t = t2 To t1 Step 0.0001x = X0 + r * Cos(t)y = Y0 + r * Sin(t)Picture1.PSet (x, y)Next tEnd IfEnd IfEnd SubPrivate Sub Command2_Click()Pictur
13、e1.ClsReDim pt(1)End SubPrivate Sub Command3_Click()EndEnd Sub四、 实验结果13实验报告(三)一、 实验题目运用 VB 件 制 Bezier曲 二、 实验目的1 、了解服装 CAD 中的常用曲 ,通 操作加以深入 ;2 、了解 Bezier曲 的特点,根据Bezier曲 的基本原理,推断出 制方法并 行操作;3 、运用 Visual Basic 6.0 件 写程序 曲 的成功 制。三、 实验内容1 、实验原理 空 有n+1个点 P0 ,P1 ,P2 , Pn , 称下列函数所决定的参数曲 Bezier曲 :nQ(t )PBii,n
14、(t )(0t1)i 0式(1-1)中, Bi ,n (t )Cni(1 t) n i ti (i 0,1,L , n)在 定几个点 ,可在t0 ,1 区 取一系列 ,相 的 算一系列的 x(t) ,y(t) ,z(t) 的 ,由此可确定空 曲 上各点的位置, 接后即得 空 曲 。142 、源代码VERSION 5.00Begin VB.Form BezierCaption=Bezier曲线 ClientHeight=7575ClientLeft=60ClientTop=450ClientWidth=9255LinkTopic=Form1ScaleHeight=7575ScaleWidth=9
15、255StartUpPosition =3 窗口缺省Begin VB.CommandButton Command2Caption=取消Height=495Left=3840TabIndex=3Top=6600Width=1455EndBegin VB.CommandButton Command3Caption=退出Height=495Left=6720TabIndex=2Top=6600Width=1455EndBegin VB.CommandButton Command1Caption=画弧Height=495Left=1080TabIndex=1Top=6600Width=1455EndB
16、egin VB.PictureBox Picture1Height=5655Left=60015ScaleHeight=5595ScaleWidth=7995TabIndex=0Top=480Width=8055EndEndAttribute VB_Name = BezierAttribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalsePrivate pt() As mypointPrivate Sub
17、Form_Load()ReDim pt(1)End SubPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)Dim s As Integerpt(UBound(pt).x = xpt(UBound(pt).y = yPicture1.Circle (x, y), 15s = Val(UBound(pt)Select Case sCase 1Picture1.Print P0Case 2Picture1.Print P1Case 3Picture1.Print
18、P2Case 4Picture1.Print P3Case 5Picture1.Print P4Case 6Picture1.Print P5Case 7Picture1.Print P6Case 8Picture1.Print P7Case 9Picture1.Print P816Case 10Picture1.Print P9Case 11Picture1.Print P10End SelectIf UBound(pt) 1 ThenPicture1.Line(pt(UBound(pt)- 1).x,pt(UBound(pt)-1).y)-(pt(UBound(pt).x, pt(UBou
19、nd(pt).y)End IfReDim Preserve pt(UBound(pt) + 1)End SubPrivate Sub Command1_Click()Dim i%, t#Dim j, n As IntegerDim s, x, y As Singlen = UBound(pt) - 1 - 1For j = 1 To 1000x = 0y = 0For i = 0 To nt = j / 1000x = x + pt(i + 1).x * B(i, n, t)y = y + pt(i + 1).y * B(i, n, t)Next iPicture1.PSet (x, y)Ne
20、xt jEnd SubPrivate Function fact(n As Integer)Dim i As IntegerDim s As Longs = 1For i = 1 To ns = s * iNext ifact = sEnd FunctionPrivate Function B(i%, n%, t#) As SingleB = (fact(n) * t i * (1 - t) (n - i) / (fact(i) * fact(n - i)End FunctionPrivate Sub Command2_Click()Picture1.ClsReDim pt(1)pt(1)为第
21、一个点 P017End SubPrivate Sub Command3_Click()EndEnd Sub四、 实验结果18实验报告(四)一、 实验题目运用 VB 软件绘制三次Hermite曲线二、 实验目的1 、了解服装 CAD 中的常用曲线,通过实际操作加以深入认识;2 、了解 Hermite曲线的特点,根据Hermite曲线的基本原理,推断出绘制方法并进行操作;3 、运用 VisualBasic6.0 软件编写程序实现Hermite曲线的成功绘制。三、 实验内容1 、实验原理19三次 Hermite 样条曲线的一般表达式为:Q(t)=At3Bt2CtD0t 1( 2)-1上式中A、B、
22、、D四个系数矢量可以根据具体已知条件来确定。C已知曲线端点P0 ( t0),P1 (t1)和该曲线在两个端点的切线矢量, P0 (t 0), P1 (t 1), 则可得下面结果:Q(0)=D=P 0Q(1) ABCDP1Q (0)CP0Q (1)=3A+2B+C=P1解上面 的方程组得:A=2( PP )P P0101B 3( P1P0 ) 2P0P1CP 0DP0将上面结果中的系数A 、 B 、 C、 D 代入式 (2-1) 中,并整理成下面的表达式:Q(t)=(2t 33t 21) P( 2t33t 2 )P ( t32t2t ) P (t3t 2 ) P 0101上式即为三次Hermit
23、e 曲线表达式。当给定 P0(x, y, z), P1 ( x, y , z), P0 ( x, y , z), P1 ( x, y, z)时,可在 t0,1 区间中取一系列值,相应的计算一系列的x(t),y(t),z(t)的值,由此可确定空间曲线上各点的位置,连接后即得该空间曲线。2、源代码VERSION 5.00Begin VB.Form HermiteCaption=三次 Hermite曲线 ClientHeight=7575ClientLeft=60ClientTop=450ClientWidth=9255LinkTopic=Form1ScaleHeight=7575ScaleWidt
24、h=9255StartUpPosition =3 窗口缺省Begin VB.PictureBox Picture1Height=5655Left=600ScaleHeight= 5595ScaleWidth=7995TabIndex=3Top=480Width=8055EndBegin VB.CommandButton Command1Caption=画弧Height=495Left=120020TabIndex= 2Top=6600Width=1455EndBegin VB.CommandButton Command3Caption=退出Height=495Left=6600TabIndex
25、=1Top=6600Width=1455EndBegin VB.CommandButton Command2Caption=取消Height=495Left=3960TabIndex=0Top=6600Width=1455EndEndAttribute VB_Name = HermiteAttribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalsePrivate pt() As mypointPrivat
26、e Sub Form_Load()ReDim pt(1)End SubPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)Dim s As Integerpt(UBound(pt).x = xpt(UBound(pt).y = yPicture1.Circle (x, y), 1s = Val(UBound(pt)Select Case sCase 1Picture1.Print P0Case 2Picture1.Print P121Case 3Picture1
27、.Print P01曲线在 P0 点处的切线矢量Picture1.Line (pt(1).x, pt(1).y)-(pt(3).x, pt(3).y)Case 4Picture1.Print P11曲线在 P1 点处的切线矢量Picture1.Line (pt(2).x, pt(2).y)-(pt(4).x, pt(4).y)End SelectReDim Preserve pt(UBound(pt) + 1)End SubPrivate Sub Command1_Click()Dim Ax, Bx, Cx, Dx, Ay, By, Cy, Dy As SingleDim P01x!, P11
28、y!Dim j%, t As SingleP01x = 2 * (pt(3).x - pt(1).x)P01y = 2 * (pt(3).y - pt(1).y)P11x = 2 * (pt(2).x - pt(UBound(pt) - 1).x)P11y = 2 * (pt(2).y - pt(UBound(pt) - 1).y)Ax = 2 * (pt(1).x - pt(2).x) + P01x + P11xAy = 2 * (pt(1).y - pt(2).y) + P01y + P11yBx = 3 * (pt(2).x - pt(1).x) - 2 * P01x - P11xBy
29、= 3 * (pt(2).y - pt(1).y) - 2 * P01y - P11yCx = P01xCy = P01yDx = pt(1).xDy = pt(1).yFor j = 1 To 1000t = j / 1000x = Ax * t 3 + Bx * t 2 + Cx * t + Dxy = Ay * t 3 + By * t 2 + Cy * t + DyPicture1.PSet (x, y)Next jEnd SubPrivate Sub Command2_Click()Picture1.ClsReDim pt(1)pt(1)为第一个点 P0End SubPrivate Sub Command3_Click()EndEnd SubPrivate Sub Fo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年采供血机构服务行业投资评估规划分析报告及未来五至十年产品升级与结构优化
- 2026惠州城市职业学院合同制教师招聘笔试备考试题及答案解析
- 2026年沛县教师招聘考试备考题库及答案解析
- 2026年景宁畲族自治县教师招聘考试参考题库及答案解析
- 2026年其他机械设备及电子产品批发行业市场现状分析报告及未来五至十年碳中和与循环经济
- 2026年其他电气机械及器材制造行业投资战略研究报告及未来五至十年跨界融合与颠覆创新
- 2026年中冶南方工程技术有限公司人员招聘笔试参考试题及答案详解
- 幼儿园教师儿童安全教育标准手册
- 关于请求延长合作期限函(6篇)
- 关于特殊要求的处理函7篇范文
- 交通运输行业春季策略:中东变局下航运船舶展望海峡受限类比弹簧压缩重视释放后全板块弹性-
- 铝方通吊顶施工常见问题处理方案
- 钛铁矿开发项目可行性研究报告
- 儿童暴发性心肌炎诊治核心2026
- 2026高处安装、维护、拆除作业题库及答案
- 物业中控外包合同
- AQ 3026-2026《化工企业设备检修作业安全规范》解读课件
- 2026年上海市闵行区高三二模英语卷(含答案及解析)
- 经营服务费合同范本
- 早期维新思想课件
- 外墙外保温系统应用技术标准(岩棉) DG-TJ08-2126-2023
评论
0/150
提交评论