panterra
Administrator
Dołączył: 18 Lut 2006
Posty: 54
Przeczytał: 0 tematów
Ostrzeżeń: 0/10
Skąd: wielkopolska Płeć: Mężczyzna
|
Wysłany:
Czw 21:26, 15 Cze 2006 |
 |
Dim ark1 As Worksheet, xp As Double, yp As Double, xk As Double, yk As Double, deltax As Double, deltay As Double
Dim bi As Double, di As Double, xi As Double, yi As Double, bo As Double, n As Double
Dim i As Integer, u As Double, v As Double, bk As Double, d As Double
Sub ortog()
Set ark1 = Worksheets(1)
bk = Cells(7, 2).Value
xp = Cells(1, 2).Value
xk = Cells(2, 2).Value
yp = Cells(4, 2).Value
yk = Cells(5, 2).Value
deltax = xk - xp
deltay = yk - yp
Cells(3, 2).Value = deltax
Cells(6, 2).Value = deltay
u = deltax / bk
v = deltay / bk
bo = Sqr(deltax ^ 2 + deltay ^ 2)
Cells(7, 4).Value = bo
n = 50
For i = 20 To n
di = Cells(i, 3).Value
bi = Cells(i, 2).Value
If di <> 0 Then
xi = xp + bi * u - di * v
Cells(i, 4).Value = xi
yi = yp + bi * v + di * u
Cells(i, 5).Value = yi
End If
If di <> 0 And bi = 0 Then
xi = xp + bi * u - di * v
Cells(i, 4).Value = xi
yi = yp + bi * v + di * u
Cells(i, 5).Value = yi
End If
If bi <> 0 And di = 0 Then
xi = xp + bi * u - di * v
Cells(i, 4).Value = xi
yi = yp + bi * v + di * u
Cells(i, 5).Value = yi
End If
If di = 0 And bi = 0 Then
xi = 0 And yi = 0
End If
Next i
End Sub |
Post został pochwalony 0 razy |
|