CLICK HERE FOR THOUSANDS OF FREE BLOGGER TEMPLATES »

11 Şubat 2008 Pazartesi

3D Küp Prizma Piramit

Line komutu ile 3D Şekil çizimi
'3D Küp Prizma Piramit ve Yıldız
'Programlayan OKTAYYAZILIM
'İnternet Adresi www.oktayyazilim.programlari.com
'E-Posta oktaysoftware@yahoo.com
'14.09.2004
'Form üzerine 1 adet Label 1 adet Timer 4 adet Option yerleştirin
'Küp çizimi:
'Bunun için iki adet daire uzerine 90 derece açılı
'4+4 toplam 8 noktayı belirlenir.
'2 dairedeki bu dört noktayı birer kare oluşturacak şekilde
'line komutu ile birleştirilir.
'Oluşan bu iki karenin köşeleri yine line komutu ile
'birleştirerek küp oluşturulur.
'Prizma çizimi de yine aynı mantıkta fakat 4 yerine 3
'nokta alınmalı
'Piramit çiziminde tek bir kareyi çizilir ve bköşelerini tek bir
'noktada birleştirilir.
'Yıldız çiziminde 5 nokta alınıp bu noktalar yıldız oluştu-
'racak şekilde line komutu ile birleştirilir.

Private Sub Form_Load()
Form1.Caption = "www.oktayyazilim.programlari.com"
Form1.BackColor = vbbalck
Form1.ForeColor = vbGreen
Form1.DrawWidth = 3
Label1 = -10
Option1.Caption = "Küp"
Option2.Caption = "Prizma"
Option3.Caption = "Piramit"
Option4.Caption = "Yıldız"
Option1.Value = True
Timer1.Interval = 1
Timer1.Enabled = True
End Sub

Private Sub kup()
Dim x1, y1, rp, korx, kory
Dim x2, y2, der, x3, y3, x4, y4, x5, x6, x7, x8, y5, y6, y7, y8
Cls
Label1 = Label1 + 10

korx = 800
kory = 1000
rp = 600



der = Label1 Mod 360
y1 = korx + rp * Sin(Label1 * 3.1415 / 180)
x1 = kory + rp * Cos(Label1 * 3.1415 / 180)

der = (Label1 + 90) Mod 360
y2 = korx + rp * Sin(der * 3.1415 / 180)
x2 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 180) Mod 360
y3 = korx + rp * Sin(der * 3.1415 / 180)
x3 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 270) Mod 360
y4 = korx + rp * Sin(der * 3.1415 / 180)
x4 = kory + rp * Cos(der * 3.1415 / 180)


Line (x1, y1)-(x2, y2)
Line (x2, y2)-(x3, y3)
Line (x3, y3)-(x4, y4)
Line (x4, y4)-(x1, y1)

korx = 1700

der = Label1 Mod 360
y5 = korx + rp * Sin(Label1 * 3.1415 / 180)
x5 = kory + rp * Cos(Label1 * 3.1415 / 180)

der = (Label1 + 90) Mod 360
y6 = korx + rp * Sin(der * 3.1415 / 180)
x6 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 180) Mod 360
y7 = korx + rp * Sin(der * 3.1415 / 180)
x7 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 270) Mod 360
y8 = korx + rp * Sin(der * 3.1415 / 180)
x8 = kory + rp * Cos(der * 3.1415 / 180)


Line (x5, y5)-(x6, y6)
Line (x6, y6)-(x7, y7)
Line (x7, y7)-(x8, y8)
Line (x8, y8)-(x5, y5)

Line (x1, y1)-(x5, y5)
Line (x2, y2)-(x6, y6)
Line (x3, y3)-(x7, y7)
Line (x4, y4)-(x8, y8)




If Label1 = 360 Then Label1 = -10

DoEvents
End Sub

Private Sub prizma()
Dim x1, y1, rp, korx, kory
Dim x2, y2, der, x3, y3, x4, y4, x5, x6, x7, x8, y5, y6, y7, y8
Cls
Label1 = Label1 + 10

korx = 800
kory = 1000
rp = 600



der = Label1 Mod 360
y1 = korx + rp * Sin(Label1 * 3.1415 / 180)
x1 = kory + rp * Cos(Label1 * 3.1415 / 180)

der = (Label1 + 120) Mod 360
y2 = korx + rp * Sin(der * 3.1415 / 180)
x2 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 240) Mod 360
y3 = korx + rp * Sin(der * 3.1415 / 180)
x3 = kory + rp * Cos(der * 3.1415 / 180)



Line (x1, y1)-(x2, y2)
Line (x2, y2)-(x3, y3)
Line (x3, y3)-(x1, y1)


korx = 2200

der = Label1 Mod 360
y5 = korx + rp * Sin(Label1 * 3.1415 / 180)
x5 = kory + rp * Cos(Label1 * 3.1415 / 180)

der = (Label1 + 120) Mod 360
y6 = korx + rp * Sin(der * 3.1415 / 180)
x6 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 240) Mod 360
y7 = korx + rp * Sin(der * 3.1415 / 180)
x7 = kory + rp * Cos(der * 3.1415 / 180)



Line (x5, y5)-(x6, y6)
Line (x6, y6)-(x7, y7)
Line (x7, y7)-(x5, y5)

Line (x1, y1)-(x5, y5)
Line (x2, y2)-(x6, y6)
Line (x3, y3)-(x7, y7)





If Label1 = 360 Then Label1 = -10

DoEvents
End Sub


Private Sub piramit()
Dim x1, y1, rp, korx, kory
Dim x2, y2, der, x3, y3, x4, y4, x5, x6, x7, x8, y5, y6, y7, y8
Cls
Label1 = Label1 + 10

korx = 2200
kory = 1000
rp = 800



der = Label1 Mod 360
y1 = korx + rp * Sin(Label1 * 3.1415 / 180)
x1 = kory + rp * Cos(Label1 * 3.1415 / 180)

der = (Label1 + 90) Mod 360
y2 = korx + rp * Sin(der * 3.1415 / 180)
x2 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 180) Mod 360
y3 = korx + rp * Sin(der * 3.1415 / 180)
x3 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 270) Mod 360
y4 = korx + rp * Sin(der * 3.1415 / 180)
x4 = kory + rp * Cos(der * 3.1415 / 180)


Line (x1, y1)-(x2, y2)
Line (x2, y2)-(x3, y3)
Line (x3, y3)-(x4, y4)
Line (x4, y4)-(x1, y1)

korx = 1700



Line (x1, y1)-(1000, 500)
Line (x2, y2)-(1000, 500)
Line (x3, y3)-(1000, 500)
Line (x4, y4)-(1000, 500)





If Label1 = 360 Then Label1 = -10

DoEvents
End Sub

Private Sub yildiz()
Dim x1, y1, rp, korx, kory
Dim x2, y2, der, x3, y3, x4, y4, x5, x6, x7, x8, y5, y6, y7, y8
Cls
Label1 = Label1 + 10

korx = 800
kory = 1000
rp = 600



der = Label1 Mod 360
y1 = korx + rp * Sin(Label1 * 3.1415 / 180)
x1 = kory + rp * Cos(Label1 * 3.1415 / 180)

der = (Label1 + 72) Mod 360
y2 = korx + rp * Sin(der * 3.1415 / 180)
x2 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 144) Mod 360
y3 = korx + rp * Sin(der * 3.1415 / 180)
x3 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 216) Mod 360
y4 = korx + rp * Sin(der * 3.1415 / 180)
x4 = kory + rp * Cos(der * 3.1415 / 180)

der = (Label1 + 288) Mod 360
y5 = korx + rp * Sin(der * 3.1415 / 180)
x5 = kory + rp * Cos(der * 3.1415 / 180)

Line (x1, y1)-(x3, y3)
Line (x2, y2)-(x4, y4)
Line (x3, y3)-(x5, y5)
Line (x4, y4)-(x1, y1)
Line (x5, y5)-(x2, y2)



If Label1 = 360 Then Label1 = -10

DoEvents
End Sub

Private Sub Timer1_Timer()
If Option1.Value = True Then kup
If Option2.Value = True Then prizma
If Option3.Value = True Then piramit
If Option4.Value = True Then yildiz
End Sub

0 yorum: