'Dieser Sourcecode stammt von http://www.VB-fun.de
'und kann frei verwendet werden. Für eventuell
'auftretende Schäden wird keine Haftung übernommen.
'Bei Fehlern oder Fragen einfach eine Mail an: tipps@VB-fun.de
'Ansonsten viel Spaß und Erfolg mit diesem Sourcecode.
Option Explicit
Dim x(4) As Long
Dim Y(4) As Long
Dim Z(4) As Long
Dim Xr(4) As Long
Dim Yr(4) As Long
Dim Zr(4) As Long
Dim Xd(4) As Long
Dim Yd(4) As Long
Dim Points As Long
Private Sub Form_Load()
Points = 4
x(0) = 100
Y(0) = 100
Z(0) = 1000
x(1) = -100
Y(1) = 100
Z(1) = 1000
x(2) = -100
Y(2) = -100
Z(2) = 2000
x(3) = 100
Y(3) = -100
Z(3) = 2000
End Sub
Private Sub Command1_Click()
Dim CenterX As Long, CenterY As Long, i As Integer, Rad As Double
CenterX = Picture1.ScaleWidth / 2
CenterY = Picture1.ScaleHeight / 2
Command3.Enabled = True
Rad = 6.28 / 100 * VScroll1.Value
For i = 0 To Points - 1
Xr(i) = Cos(Rad) * (x(i)) + Sin(Rad) * (Y(i))
Yr(i) = Cos(Rad) * (Y(i)) - Sin(Rad) * (x(i))
Zr(i) = Z(i)
Xd(i) = Xr(i) * 512 / Zr(i) + CenterX
Yd(i) = Yr(i) * 512 / Zr(i) + CenterY
Debug.Print x(i); Y(i); Z(i)
Debug.Print Xd(i); Yd(i)
Next i
Picture1.Cls
For i = 0 To Points - 2
Picture1.Line (Xd(i), Yd(i))-(Xd(i + 1), Yd(i + 1)), _
RGB(255, 0, 0)
Next i
Picture1.Line (Xd(Points - 1), Yd(Points - 1))-(Xd(0), Yd(0)), _
RGB(255, 0, 0)
'Kann ich den Teil hier irgendwie(?) durch eine rotierende Grafik...
'...anstatt Linien ersetzen? Bitte helft mir!
End Sub
Private Sub Command2_Click()
Unload Me
End
End Sub
Private Sub Command3_Click()
Dim x As Integer
For x = VScroll1.Min To VScroll1.Max
VScroll1.Value = x
Next
End Sub
Private Sub VScroll1_Change()
Command1_Click
Label1.Caption = VScroll1.Value * 3.6
End Sub
Private Sub VScroll1_Scroll()
Command1_Click
Label1.Caption = VScroll1.Value * 3.6
End Sub