View.Set ("offscreenonly,graphics:640;640")
var x : array 1 .. 8 of real := init (100, 100, 100, 100, 500, 500, 500, 500)
var y : array 1 .. 8 of real := init (100, 100, 500, 500, 100, 100, 500, 500)
var z : array 1 .. 8 of real := init (-250, -750, -250, -750, -250, -750, -250, -750)
var px, py, pz,X, Y, Z, relZ, relX, relY : real := maxx div 2
var x0, y0, z0, x9, y9, diffx, diffy : int := 0
loop
X := 0
Y := 0
Z := 0
x9 := x0
y9 := y0
mousewhere (x0, y0, z0)
diffx := x0 - x9
diffy := y0 - y9
for i : 1 .. 8
X += x (i)
Y += y (i)
Z += z (i)
end for
X /= 8
Y /= 8
Z /= 8
for i : 1 .. 8
relZ := (((Z - z (i)) * cosd (-diffx * z0)) + ((X - x (i)) * sind (-diffx * z0)))
relX := (((X - x (i)) * cosd (-diffx * z0)) - ((Z - z (i)) * sind (-diffx * z0)))
x (i) := X - relX
z (i) := Z - relZ
relZ := (((Z - z (i)) * cosd (-diffy * z0)) + ((Y - y (i)) * sind (-diffy * z0)))
relY := (((Y - y (i)) * cosd (-diffy * z0)) - ((Z - z (i)) * sind (-diffy * z0)))
y (i) := Y - relY
z (i) := Z - relZ
relX := (((X - x (i)) * cosd (-diffy * z0)) + ((Y - y (i)) * sind (-diffy * z0)))
relY := (((Y - y (i)) * cosd (-diffy * z0)) - ((X - x (i)) * sind (-diffy * z0)))
y (i) := Y - relY
x (i) := X - relX
end for
for i : 1 .. 8
for k : 1 .. 8
drawline (round ((100 - (z (i) - (((z (i) - pz) / (x (i) - px) + 0.001) * x (i))) / ((z (i) - pz) / (x (i) - px) + 0.001))),round ((100 * ((y (i) - py) / (z (i) - pz) + 0.001)) + (y (i) - (((y (i) - py) / (z (i) - pz) + 0.001) * z (i)))),
round ((100 - (z (k) - (((z (k) - pz) / (x (k) - px) + 0.001) * x (k))) / ((z (k) - pz) / (x (k) - px) + 0.001))),round ((100 * ((y (k) - py) / (z (k) - pz) + 0.001)) + (y (k) - (((y (k) - py) / (z (k) - pz) + 0.001) * z (k)))), black)
end for
end for
View.Update
cls
end loop |