CAD原理实验报告.docx

上传人:大张伟 文档编号:6148194 上传时间:2020-09-13 格式:DOCX 页数:43 大小:168.33KB
返回 下载 相关 举报
CAD原理实验报告.docx_第1页
第1页 / 共43页
CAD原理实验报告.docx_第2页
第2页 / 共43页
CAD原理实验报告.docx_第3页
第3页 / 共43页
CAD原理实验报告.docx_第4页
第4页 / 共43页
CAD原理实验报告.docx_第5页
第5页 / 共43页
点击查看更多>>
资源描述

《CAD原理实验报告.docx》由会员分享,可在线阅读,更多相关《CAD原理实验报告.docx(43页珍藏版)》请在三一文库上搜索。

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上式即为三次Hermite 曲线表达式。当给定 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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1