




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、數(shù)控原理課程設(shè)計:逐點插補法四象限直線,四象限圓弧順逆,過象限圓弧順逆 程序以及運行截圖工具:Vb6.0Private Sub Command1_Click()Dim xe%, ye%, a%, b%, f%, l%, m%xe = Val(Text1.Text)ye = Val(Text2.Text)f = 0a = 0b = 0Picture1.ClsPicture1.Scale (-10, 10)-(10, -10)Picture1.Line (-10, 0)-(10, 0)Picture1.Line (0, 10)-(0, -10)Picture1.CurrentX = 0: Pict
2、ure1.CurrentY = 0: Picture1.Print 0For l = -9 To 9 Step 1Picture1.CurrentX = l: Picture1.CurrentY = 0: Picture1.Print lPicture1.CurrentX = 0: Picture1.CurrentY = l: Picture1.Print lNext lPicture1.Line (0, 0)-(xe, ye)直線第一象限If xe > 0 And ye > 0 ThenDo Until a = xe And b = yeIf f >= 0 Thena =
3、a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - Abs(ye)Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + Abs(xe)End IfPicture1.PSet (a, b)LoopEnd If直線第二象限If xe < 0 And ye > 0 ThenDo Until a = xe And b = yeIf f >= 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(
4、1)f = f - Abs(ye)Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + Abs(xe)End IfPicture1.PSet (a, b)LoopEnd If直線第三象限If xe < 0 And ye < 0 ThenDo Until a = xe And b = yeIf f >= 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - Abs(ye)Elseb = b - 1Picture1.Line (a
5、, b + 1)-(a, b), QBColor(1)f = f + Abs(xe)End IfPicture1.PSet (a, b)LoopEnd If直線第四象限If xe > 0 And ye < 0 ThenDo Until a = xe And b = yeIf f >= 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - Abs(ye)Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + Abs(xe)End
6、IfPicture1.PSet (a, b)LoopEnd IfEnd Sub圓弧插補Private Sub Command2_Click()Dim xe%, ye%, a%, b%, f!, x1%, y1%, r!, x!, y!, c!, d!, g%, h%xe = Val(Text1.Text)ye = Val(Text2.Text)x1 = Val(Text3.Text)y1 = Val(Text4.Text)r = Sqr(xe * xe + ye * ye)a = x1b = y1c = Abs(x1)d = Abs(y1)Picture1.ClsPicture1.Scale
7、(-10, 10)-(10, -10)Picture1.Line (-10, 0)-(10, 0)Picture1.Line (0, 10)-(0, -10)Picture1.CurrentX = 0: Picture1.CurrentY = 0: Picture1.Print 0For l = -9 To 9 Step 1Picture1.CurrentX = l: Picture1.CurrentY = 0: Picture1.Print lPicture1.CurrentX = 0: Picture1.CurrentY = l: Picture1.Print lNext l逆圓第一象限I
8、f xe >= 0 And ye >= 0 And x1 >= 0 And y1 >= 0 And xe < x1 ThenFor x = x1 To xe Step -0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f >= 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Pi
9、cture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If逆圓第二象限If xe <= 0 And ye >= 0 And x1 <= 0 And y1 >= 0 And xe < x1 ThenFor x = x1 To xe Step -0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = ye
10、If f >= 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If逆圓第三象限If xe <= 0 And ye <= 0 And x1 <= 0 And y1 <= 0 An
11、d xe > x1 ThenFor x = x1 To xe Step 0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f >= 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d)
12、+ 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If逆圓第四象限If xe >= 0 And ye <= 0 And x1 >= 0 And y1 <= 0 And xe > x1 ThenFor x = x1 To xe Step 0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f >= 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), Q
13、BColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If順圓第一象限If xe >= 0 And ye >= 0 And x1 >= 0 And y1 >= 0 And xe > x1 ThenFor x = x1 To xe Step 0.0001y = Sqr(r * r -
14、 x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f >= 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If順圓第二象限If
15、 xe <= 0 And ye >= 0 And x1 <= 0 And y1 >= 0 And xe > x1 ThenFor x = x1 To xe Step 0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f >= 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Pict
16、ure1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If順圓第三象限If xe <= 0 And ye <= 0 And x1 <= 0 And y1 <= 0 And xe < x1 ThenFor x = x1 To xe Step -0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeI
17、f f >= 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd If順圓第四象限If xe >= 0 And ye <= 0 And x1 >= 0 And y1 <= 0 And
18、 xe < x1 ThenFor x = x1 To xe Step -0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xDo Until a = xe And b = yeIf f >= 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d)
19、+ 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd If圓弧過象限 過第一第二象限的逆圓If x1 >= 0 And y1 >= 0 And xe <= 0 And ye >= 0 ThenFor x = x1 To xe Step -0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xg = 0h = rIf x1 >= 0 And y1 >= 0 And g >= 0 And h >= 0 And g < x1 ThenDo Unt
20、il a = g And b = hIf f >= 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe <= 0 And ye >= 0 And g <= 0 And h
21、>= 0 And xe < g ThenDo Until a = xe And b = yeIf f >= 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If圓弧第二第三象限的
22、逆圓If x1 <= 0 And y1 >= 0 And xe <= 0 And ye <= 0 ThenFor y = y1 To ye Step -0.0001x = -Sqr(r * r - y * y)Picture1.PSet (x, y)Next yg = -1 * rh = 0If x1 <= 0 And y1 >= 0 And g <= 0 And h >= 0 And g < x1 ThenDo Until a = g And b = hIf f >= 0 Thenb = b - 1Picture1.Line (a,
23、 b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe <= 0 And ye <= 0 And g <= 0 And h <= 0 And xe > g ThenDo Until a = xe And b = yeIf f >
24、= 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If三四象限逆圓If x1 <= 0 And y1 <= 0 And xe >= 0 And ye <= 0 ThenF
25、or x = x1 To xe Step 0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xg = 0h = -rIf g <= 0 And h <= 0 And x1 <= 0 And y1 <= 0 And g > x1 ThenDo Until a = g And b = hIf f >= 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b
26、 - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe >= 0 And ye <= 0 And g >= 0 And h <= 0 And xe > g ThenDo Until a = xe And b = yeIf f >= 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 *
27、 Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If14象限逆圓If x1 >= 0 And y1 <= 0 And xe >= 0 And ye >= 0 ThenFor y = y1 To ye Step 0.0001x = Sqr(r * r - y * y)Picture1.PSet (x, y)Ne
28、xt yg = rh = 0If g >= 0 And h <= 0 And x1 >= 0 And y1 <= 0 And g > x1 ThenDo Until a = g And b = hIf f >= 0 Thenb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c =
29、Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe >= 0 And ye >= 0 And g >= 0 And h >= 0 And g > xe ThenDo Until a = xe And b = yeIf f >= 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QB
30、Color(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If12象限順圓If x1 <= 0 And y1 >= 0 And xe > 0 And ye > 0 ThenFor x = x1 To xe Step 0.0001y = Sqr(r * r - x * x)Picture1.PSet (x, y)Next xg = 0h = rIf g <= 0 And h >= 0 And x1 <= 0 And y1 >= 0 And
31、g > x1 ThenDo Until a = g And b = hIf f >= 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe >= 0 And ye >= 0
32、And g >= 0 And h >= 0 And xe > g ThenDo Until a = xe And b = yeIf f >= 0 Thenb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopE
33、nd IfEnd If23象限順圓If x1 <= 0 And y1 <= 0 And xe < 0 And ye > 0 ThenFor y = y1 To ye Step 0.0001x = -Sqr(r * r - y * y)Picture1.PSet (x, y)Next yg = -rh = 0If g <= 0 And h <= 0 And x1 <= 0 And y1 <= 0 And g < x1 ThenDo Until a = g And b = hIf f >= 0 Thenb = b + 1Picture1.
34、Line (a, b - 1)-(a, b), QBColor(1)f = f - 2 * Abs(d) + 1d = Abs(d) - 1Elsea = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f + 2 * Abs(c) + 1c = Abs(c) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe <= 0 And ye >= 0 And g <= 0 And h >= 0 And xe > g ThenDo Until a = xe And b = yeI
35、f f >= 0 Thena = a + 1Picture1.Line (a - 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b + 1Picture1.Line (a, b - 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfEnd If34順圓If x1 >= 0 And y1 <= 0 And xe < 0 And ye < 0 T
36、henFor x = x1 To xe Step -0.0001y = -Sqr(r * r - x * x)Picture1.PSet (x, y)Next xg = 0h = -rIf g >= 0 And h <= 0 And x1 >= 0 And y1 <= 0 And g < x1 ThenDo Until a = g And b = hIf f >= 0 Thena = a - 1Picture1.Line (a + 1, b)-(a, b), QBColor(1)f = f - 2 * Abs(c) + 1c = Abs(c) - 1Elseb = b - 1Picture1.Line (a, b + 1)-(a, b), QBColor(1)f = f + 2 * Abs(d) + 1d = Abs(d) + 1End IfPicture1.PSet (a, b)LoopEnd IfIf xe <= 0 And ye <= 0 And g <= 0 And h <= 0 And xe < g ThenDo Until a = xe And b = yeIf f >= 0 Thenb = b
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《碳中和概論》課件第1章 緒論
- 智能家電產(chǎn)品代理銷售及售后服務(wù)協(xié)議
- 語文現(xiàn)代散文閱讀理解技巧提升課
- 《五言絕句詩詞教學(xué):唐詩的欣賞與創(chuàng)作》
- 市場營銷推廣合作協(xié)議詳細版
- 學(xué)習(xí)的重要性演講演講稿類話題12篇
- 石油勘探項目合作合同
- 食品安全與健康營養(yǎng)知識要點梳理與解析
- 2025年藥學(xué)基礎(chǔ)知識期末考試試卷及答案
- 2025年信息傳播與社會網(wǎng)絡(luò)研究期末考試試題及答案
- 人工智能在教育行業(yè)的創(chuàng)新應(yīng)用研究
- 高考物理一輪復(fù)習(xí)考點精講精練第34講 光電效應(yīng) 波粒二象性(解析版)
- 新能源行業(yè)光伏發(fā)電技術(shù)操作指南
- 陽光心理-健康人生小學(xué)生心理健康主題班會課件
- 城口縣集中供暖工程特許經(jīng)營管理招標(biāo)文件
- 學(xué)前兒童健康教育 課件項目六 學(xué)前兒童安全教育
- 山東省臨沂市平邑縣2023-2024學(xué)年七年級下學(xué)期7月期末歷史試題(原卷版)
- 2024年山東省濰坊市中考生物試卷附答案
- 北京聯(lián)合大學(xué)微觀經(jīng)濟學(xué)期末試卷
- 肺癌胸腔鏡(肺葉切除)護理查房課件
- 云南省昆明市2023-2024學(xué)年高二下學(xué)期期末質(zhì)量檢測化學(xué)試題
評論
0/150
提交評論