Anda di halaman 1dari 1

'simulasi garis miring

If (Px <> 0) And (Py <> 0) Then


sudutS = Abs(Py / Px)
Text6.Text = sudutS
x=1
y=1
berhenti = False
Do While berhenti = False
If (Px > 0) And (Py > 0) Then
Picture1.PSet (Px1 + x, 5000 - Py1 - y), vbRed
End If
If (Px < 0) And (Py > 0) Then
Picture1.PSet (Px1 . x, 5000 - Py1 . y), vbRed
End If
If (Px > 0) And (Py < 0) Then
Picture1.PSet (Px1 . x, 5000 - Py1 . y), vbRed
End If
If (Px < 0) And (Py < 0) Then
Picture1.PSet (Px1 - x, 5000 - Py1 + y), vbRed
End If
sudutA = y / x
Text3.Text = sudutA
If sudutA < sudutS Then
'x tetap, y bertambah
x=x
y=y+1
End If
If sudutA > sudutS Then
'x bertambah, y tetap
y=y
x=x+1
End If
If sudutA = sudutS Then
x=x+1
y=y+1
End If
Text4.Text = x
Text5.Text = y
delay 5
If (x = Abs(Px)) And (y = Abs(Py)) Then
berhenti = True
End If
Loop
End If