




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、數(shù)控原理課程設(shè)計:逐點插補(bǔ)法四象限直線,四象限圓弧順逆,過象限圓弧順逆 程序以及運行截圖工具: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圓弧插補(bǔ)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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 補(bǔ)充協(xié)議能否推翻原合同
- 2025年特色小鎮(zhèn)產(chǎn)業(yè)定位與區(qū)域產(chǎn)業(yè)可持續(xù)發(fā)展戰(zhàn)略評估報告
- 廣告設(shè)計師網(wǎng)絡(luò)傳播策略試題及答案
- 2024年高效紡織工程師備考策略試題及答案
- 紡織品設(shè)計師證書考試的重要角色分工與試題答案
- 衛(wèi)生保健學(xué)試題及答案
- 紡織自動化技術(shù)的發(fā)展現(xiàn)狀試題及答案
- 檢驗科試題及答案app
- 廣東省香山中學(xué)、高要一中、廣信中學(xué)2024-2025學(xué)年度高一下學(xué)期第一次教學(xué)質(zhì)量檢測生物試題(含答案)
- 祁縣語文面試題及答案
- 人工智能自動駕駛系統(tǒng)開發(fā)項目應(yīng)急預(yù)案
- 思想道德與法治2023版教學(xué)設(shè)計第二章 追求遠(yuǎn)大理想 堅定崇高信念
- 牛津譯林英語-九年級上冊Unit2Reading-(共30張PPT)
- 《影視光線藝術(shù)與照明技巧》word版本
- 主題班會:君子自強(qiáng)不息
- 《格林童話》讀書分享ppt
- 阿里云:生來創(chuàng)新-金融級云原生
- 兒科護(hù)理學(xué)第二章生長發(fā)育
- 高中數(shù)學(xué)說題課件
- 文檔文檔防淹門
- 機(jī)電安裝施工工藝及質(zhì)量驗收標(biāo)準(zhǔn)
評論
0/150
提交評論