1、CAD原理实验报告服装CAD原理与应用实验报告实验报告(一)三点画圆弧-(02-07)实验报告(二)两点画圆弧-(08-12)实验报告(三)Bezier曲线的绘制-(13-17)实验报告(四)Hermite曲线的绘制-(18-22)实验报告(五)B样条曲线的绘制-(23-27)实验报告(一)一、 实验题目使用VB软件实现三点画圆弧二、 实验目的1了解服装CAD中的常用曲线,灵活运用理论知识加以运用,实现操作; 2掌握三点画圆弧的基本原理和绘制方法; 3运用Visual Basic 6.0软件编写程序实现通过三点的控制成功绘制圆弧。三、 实验目的1.实验原理已知三个点A(x1,y1),B(x2,
2、y2)C(x3,y3)的坐标根据中垂线相交于圆心可以求出圆心(x,y)的坐标以及半径r根据圆心以及已知三点的坐标,判断出所画圆弧的起始角,终止角和中间角的正切角度值,进而求出这三个角的角度。比较起始角,终止角和中间角这三点的角度大小,判断出所画圆弧的方向。2源代码VERSION 5.00Begin VB.Form Form1 Caption = 三点画圆弧 ClientHeight = 5835 ClientLeft = 120 ClientTop = 450 ClientWidth = 8280 LinkTopic = Form1 ScaleHeight = 5835 ScaleWidth
3、= 8280 StartUpPosition = 3 窗口缺省 Begin VB.CommandButton Command3 Caption = 退出 Height = 615 Left = 6000 TabIndex = 3 Top = 4800 Width = 1455 End Begin VB.CommandButton Command2 Caption = 取消 Height = 615 Left = 3360 TabIndex = 2 Top = 4800 Width = 1455 End Begin VB.CommandButton Command1 Caption = 画弧 H
4、eight = 615 Left = 720 TabIndex = 1 Top = 4800 Width = 1455 End Begin VB.PictureBox Picture1 Height = 4335 Left = 360 ScaleHeight = 4275 ScaleWidth = 7515 TabIndex = 0 Top = 240 Width = 7575 EndEndAttribute VB_Name = Form1Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB
5、_PredeclaredId = TrueAttribute VB_Exposed = FalsePrivate pt() 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 Integer pt(UBound(pt).x = x pt(UBound(pt).y = y Picture1.Circle (x, y), 15 s = Val(
6、UBound(pt) Select Case s Case 1 Picture1.Print A Case 2 Picture1.Print B Case 3 Picture1.Print C End Select If UBound(pt) 1 Then Picture1.Line (pt(UBound(pt) - 1).x, pt(UBound(pt) - 1).y)-(pt(UBound(pt).x, pt(UBound(pt).y) End If ReDim Preserve pt(UBound(pt) + 1)End SubPrivate Sub Command1_Click() D
7、im A1, A2, B1, B2, C1, C2 As Single Dim X0, Y0, r, PI As Double Dim t1, t2, t3 As Double Dim t As Double A1 = pt(1).x 2 + pt(1).y 2 - pt(3).x 2 - pt(3).y 2 A2 = pt(2).x 2 + pt(2).y 2 - pt(3).x 2 - pt(3).y 2 B1 = 2 * pt(3).x - 2 * pt(1).x B2 = 2 * pt(3).x - 2 * pt(2).x C1 = 2 * pt(1).y - 2 * pt(3).y
8、C2 = 2 * pt(2).y - 2 * pt(3).y X0 = (A1 * C2 - A2 * C1) / (B2 * C1 - B1 * C2) Y0 = (A1 * B2 - A2 * 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 Then t1 =
9、 t1 Else If pt(1).x - X0 0 Then t1 = t1 + PI Else If pt(1).x - X0 0 And pt(1).y - Y0 0 And pt(2).y - Y0 0 Then t2 = t2 Else If pt(2).x - X0 0 Then t2 = t2 + PI Else If pt(2).x - X0 0 And pt(2).y - Y0 0 Then t2 = t2 + PI Else t2 = t2 + 2 * PI End If End If End If If t1 t3 t2 Then For t = t1 To t2 Ste
10、p 0.001 x = X0 + r * Cos(t) y = Y0 + r * Sin(t) Picture1.PSet (x, y) Next t ElseIf t2 t1 t3 Then t2 = t2 + 2 * PI For t = t1 To t2 Step 0.001 x = X0 + r * Cos(t) y = Y0 + r * Sin(t) Picture1.PSet (x, y) Next t ElseIf t3 t2 t1 Then t2 = t2 + 2 * PI For t = t1 To t2 Step 0.001 x = X0 + r * Cos(t) y =
11、Y0 + r * Sin(t) Picture1.PSet (x, y) Next t ElseIf t1 t2 t3 Then t1 = t1 + 2 * PI For t = t2 To t1 Step 0.001 x = X0 + r * Cos(t) y = Y0 + r * Sin(t) Picture1.PSet (x, y) Next t ElseIf t3 t1 t2 Then t1 = t1 + 2 * PI For t = t2 To t1 Step 0.001 x = X0 + r * Cos(t) y = Y0 + r * Sin(t) Picture1.PSet (x
12、, y) Next t ElseIf t2 t3 0 And n 0 Then t1 = t1 ElseIf m 0 Then t1 = pi - t1 ElseIf m 0 And n 0 And n 0 And j 0 Then t2 = t2 ElseIf i 0 Then t2 = pi - t2 ElseIf i 0 And j 0 And j 0 Then If t1 t2 Then For t = t2 To t1 Step 0.0001 x = X0 + r * Cos(t) y = Y0 + r * Sin(t) Picture1.PSet (x, y) Next t Els
13、e: t1 = t1 + 2 * pi For t = t2 To t1 Step 0.0001 x = X0 + r * Cos(t) y = Y0 + r * Sin(t) Picture1.PSet (x, y) Next t End If End IfEnd SubPrivate Sub Command2_Click() Picture1.Cls ReDim pt(1)End SubPrivate Sub Command3_Click() EndEnd Sub四、 实验结果实验报告(三)一、 实验题目运用VB软件绘制Bezier曲线二、 实验目的1、了解服装CAD中的常用曲线,通过实际
14、操作加以深入认识; 2、了解Bezier曲线的特点,根据Bezier曲线的基本原理,推断出绘制方法并进行操作; 3、运用Visual Basic 6.0软件编写程序实现曲线的成功绘制。三、 实验内容1、实验原理设空间有n+1个点P0,P1,P2,Pn,则称下列函数所决定的参数曲线为Bezier曲线:在给定几个点时,可在t0,1区间取一系列值,相应的计算一系列的x(t),y(t),z(t)的值,由此可确定空间曲线上各点的位置,连接后即得该空间曲线。2、源代码VERSION 5.00Begin VB.Form Bezier Caption = Bezier曲线 ClientHeight = 757
15、5 ClientLeft = 60 ClientTop = 450 ClientWidth = 9255 LinkTopic = Form1 ScaleHeight = 7575 ScaleWidth = 9255 StartUpPosition = 3 窗口缺省 Begin VB.CommandButton Command2 Caption = 取 消 Height = 495 Left = 3840 TabIndex = 3 Top = 6600 Width = 1455 End Begin VB.CommandButton Command3 Caption = 退 出 Height =
16、495 Left = 6720 TabIndex = 2 Top = 6600 Width = 1455 End Begin VB.CommandButton Command1 Caption = 画 弧 Height = 495 Left = 1080 TabIndex = 1 Top = 6600 Width = 1455 End Begin VB.PictureBox Picture1 Height = 5655 Left = 600 ScaleHeight = 5595 ScaleWidth = 7995 TabIndex = 0 Top = 480 Width = 8055 EndE
17、ndAttribute VB_Name = BezierAttribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalsePrivate pt() As mypointPrivate Sub Form_Load() ReDim pt(1)End SubPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single,
18、 y As Single) Dim s As Integer pt(UBound(pt).x = x pt(UBound(pt).y = y Picture1.Circle (x, y), 15 s = Val(UBound(pt) Select Case s Case 1 Picture1.Print P0 Case 2 Picture1.Print P1 Case 3 Picture1.Print P2 Case 4 Picture1.Print P3 Case 5 Picture1.Print P4 Case 6 Picture1.Print P5 Case 7 Picture1.Print P6 Case 8 Picture1.Print P7 Case 9 Picture1.Print P8 Case 10 Picture1.Print P9 Case 11 Picture1.Print P10 End Select If UBound(pt) 1 Then Picture1.Line (pt(UBound(pt) - 1).x, pt(UBound(pt)
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1