DIM col
(99) AS _INTEGER64, tris
(19999, 10), points
(19999, 10), cam
(19), me
(19) dim_s = 1000 'size of space
max_vol = .4 'kocka darabszam a dim_s-hez kepest szazalekban
d_min = 4 'csucs min
d_max = 7 'csucs max
r_min = 50 'legkisebb sugar
r_max = 50 'legnagyobb_sugar
rot_min = 1 / 100 'forgatas min sebesseg
rot_max = 2 / 100 'forgatas max sebesseg
sp_kalib = 3
sp_min = .5 * sp_kalib
sp_max = 2.5 * sp_kalib
crash = 1
text_c = 50
text_d = 150
text_m = 7
text_col = 70
msenx = .05 'mouse sensitive XY
msenz = .08 'mouse sensitive Z
pre_calc = 2 'calculation for step multiplier impact test
stepping = 10 'movement speed
max_couch = 70 'correct angle of impact tolerance
zoom_calib = .01
zoom_xy = 20 * zoom_calib '_maptriangle multiplier XY
zoom_distance = 60 * zoom_calib 'maptriangle multiplier Z (as large as fisheye optics)
'-------------------------------------------------------------------------------------------------------------------------------------------------------
'creating textures
LINE (text_m
, text_m
)-(text_d
- 1 - text_m
, text_d
- 1 - text_m
), col
(INT(text_col
* RND(1))), BF
'creating 3d points
DO WHILE volume_sum
< dim_s
^ 3 / 100 * max_vol
DO: re
= 0:
'hova, es mekkora ? ob
(a_ob
, 0) = INT(d_min
+ (d_max
- d_min
) * RND(1)) 'resolution 360/da degree horisontal DA ob
(a_ob
, 1) = INT(d_min
+ (d_max
- d_min
) * RND(1)) 'resolution 360/db degree vertical DB ob(a_ob, 2) = points 'start ponits
ob
(a_ob
, 3) = r_min
+ (r_max
- r_min
) * RND(1) 'sugar FOR t
= 4 TO 6: ob
(a_ob
, t
) = ob
(a_ob
, 3) + (dim_s
- ob
(a_ob
, 3) * 2) * RND(1):
NEXT t
dis1 = ((ob(a_ob, 4) - ob(t, 4)) ^ 2 + (ob(a_ob, 5) - ob(t, 5)) ^ 2 + (ob(a_ob, 6) - ob(t, 6)) ^ 2)
dis2 = (ob(a_ob, 3) + ob(t, 3)) ^ 2
FOR t
= 7 TO 9: ob
(a_ob
, t
) = rot_min
+ (rot_max
- rot_min
) * RND(1):
NEXT t
'random rotating arrow,speed FOR t
= 10 TO 12: ob
(a_ob
, t
) = 360 * RND(1):
NEXT t
'actual rotate ob
(a_ob
, 14) = 360 * RND(1) 'radA arrow random ob
(a_ob
, 15) = 360 * RND(1) 'radB arrow random ob
(a_ob
, 16) = sp_min
+ (sp_max
- sp_min
) * RND(1) 'random speed
'creating squares
FOR da2
= 0 TO ob
(a_ob
, 0) - 2:
FOR db2
= 0 TO ob
(a_ob
, 1) - 2 p0
= da2
* ob
(a_ob
, 1) + db2
+ ob
(a_ob
, 2): p1
= p0
+ 1: p2
= p0
+ ob
(a_ob
, 1): p3
= p2
+ 1: text_act
= INT(text_c
* RND(1)) tris(triangles, 0) = 1: tris(triangles, 1) = p0: tris(triangles, 2) = p1: tris(triangles, 3) = p2: tris(triangles, 4) = 0: tris(triangles, 5) = 0
tris(triangles, 6) = text_d - 1: tris(triangles, 7) = 0: tris(triangles, 8) = 0: tris(triangles, 9) = text_d - 1: tris(triangles, 10) = text_act
triangles = triangles + 1
tris(triangles, 0) = 1: tris(triangles, 1) = p3: tris(triangles, 2) = p1: tris(triangles, 3) = p2: tris(triangles, 4) = text_d - 1
tris(triangles, 5) = text_d - 1: tris(triangles, 6) = text_d - 1: tris(triangles, 7) = 0: tris(triangles, 8) = 0: tris(triangles, 9) = text_d - 1: tris(triangles, 10) = text_act
triangles = triangles + 1
points = points + ob(a_ob, 0) * ob(a_ob, 1)
volume_sum
= volume_sum
+ (4 * ob
(a_ob
, 3) ^ 3 * _PI / 3) a_ob = a_ob + 1
'control
elt_xy
= SIN(elt2
* pip180
) * elt1: elt_z
= COS(elt2
* pip180
) * elt1
szog_xy_elt
= -90 * ABS(ka
) + 90 * ABS(kd
): szog_xy
= me
(10) + (szog_xy_elt
+ elt_xy
) * pip180: szog_z
= me
(11) + pip180
* (90 + elt_z
) irx
= -SIN(szog_xy
) * COS(szog_z
): iry
= -COS(szog_xy
) * COS(szog_z
): irz
= SIN(szog_z
): ir
= et_ir: multi
= stepping
* ir
* pre_calc
* 2 multi = stepping * ir / max_couch * (max_couch - elt1): me(0) = me(0) + irx * multi: me(1) = me(1) + iry * multi
me
(2) = me
(2) + irz
* multi:
END IF:
NEXT elt2
, elt1
me
(11) = me
(11) - 2 * _PI * ABS(me
(11) > 2 * _PI): me
(11) = me
(11) + 2 * _PI * ABS(me
(11) < 0): inv_me10
= 1:
IF me
(11) < _PI THEN inv_me10
= -1 me(10) = me(10) + mousex / 5 * msenx * inv_me10
IF me
(t
) < 0 THEN me
(t
) = me
(t
) + dim_s
IF me
(t
) > dim_s
- 1 THEN me
(t
) = me
(t
) - dim_s
'calculating objection points
FOR act_ob
= 0 TO a_ob
- 1 FOR da2
= 0 TO ob
(act_ob
, 0) - 1: dega
= (360 / (ob
(act_ob
, 0) - 1) * da2
) * pip180
FOR db2
= 0 TO ob
(act_ob
, 1) - 1: degb
= (180 / (ob
(act_ob
, 1) - 1) * db2
) * pip180
ap = da2 * ob(act_ob, 1) + db2 + ob(act_ob, 2)
x2
= (x1
* COS(ob
(act_ob
, 12))) - (y1
* SIN(ob
(act_ob
, 12))): y2
= (x1
* SIN(ob
(act_ob
, 12))) + (y1
* COS(ob
(act_ob
, 12))) x3
= (x2
* COS(ob
(act_ob
, 11))) - (z1
* SIN(ob
(act_ob
, 11))): z2
= (x2
* SIN(ob
(act_ob
, 11))) + (z1
* COS(ob
(act_ob
, 11))) y3
= (y2
* COS(ob
(act_ob
, 10))) - (z2
* SIN(ob
(act_ob
, 10))): z3
= (y2
* SIN(ob
(act_ob
, 10))) + (z2
* COS(ob
(act_ob
, 10))) points(ap, 1) = x3 * ob(act_ob, 3) + ob(act_ob, 4)
points(ap, 2) = y3 * ob(act_ob, 3) + ob(act_ob, 5)
points(ap, 3) = z3 * ob(act_ob, 3) + ob(act_ob, 6)
'calculating view
me(5) = 0
cam
(0) = me
(0) - SIN(me
(10) - 180 * pip180
) * me
(3) / 2 cam
(1) = me
(1) - COS(me
(10) - 180 * pip180
) * me
(3) / 2 cam(2) = me(2) + me(5) / 4
cam(3) = me(10)
cam(4) = me(11)
cosrotz
= COS(cam
(3)): sinrotz
= SIN(cam
(3)): cosrotx
= COS(cam
(4)): sinrotx
= SIN(cam
(4))
nei = 1
FOR cx
= -nei
TO nei: cx2
= cx
* dim_s:
FOR cy
= -nei
TO nei: cy2
= cy
* dim_s:
FOR cz
= -nei
TO nei: cz2
= cz
* dim_s
FOR actual_point
= 0 TO points
- 1:
IF points
(actual_point
, 1) THEN px = points(actual_point, 1) - cam(0) + cx2
py = points(actual_point, 2) - cam(1) + cy2
pz2 = points(actual_point, 3) - cam(2) + cz2
px3 = px * cosrotz - py * sinrotz: py2 = px * sinrotz + py * cosrotz: py3 = py2 * cosrotx - pz2 * sinrotx: pz3 = py2 * sinrotx + pz2 * cosrotx
points
(actual_point
, 4) = -px3
* zoom_xy: points
(actual_point
, 5) = -py3
* zoom_xy: points
(actual_point
, 6) = -pz3
* zoom_distance:
END IF:
NEXT actual_point
'drawing triangles
FOR actual_triangle
= 0 TO triangles
- 1 wx1 = points(tris(actual_triangle, 1), 4): wy1 = points(tris(actual_triangle, 1), 5): wz1 = points(tris(actual_triangle, 1), 6)
wx2 = points(tris(actual_triangle, 2), 4): wy2 = points(tris(actual_triangle, 2), 5): wz2 = points(tris(actual_triangle, 2), 6)
wx3 = points(tris(actual_triangle, 3), 4): wy3 = points(tris(actual_triangle, 3), 5): wz3 = points(tris(actual_triangle, 3), 6)
sx1 = tris(actual_triangle, 4): sy1 = tris(actual_triangle, 5)
sx2 = tris(actual_triangle, 6): sy2 = tris(actual_triangle, 7)
sx3 = tris(actual_triangle, 8): sy3 = tris(actual_triangle, 9)
_MAPTRIANGLE (sx1
, sy1
)-(sx2
, sy2
)-(sx3
, sy3
), text
(tris
(actual_triangle
, 10)) TO(wx1
, wy1
, wz1
)-(wx2
, wy2
, wz2
)-(wx3
, wy3
, wz3
), , _SMOOTH
'moving/rotating objects
FOR act_ob
= 0 TO a_ob
- 1 FOR t
= 0 TO 2: ob
(act_ob
, 10 + t
) = ob
(act_ob
, 10 + t
) + ob
(act_ob
, 7 + t
):
NEXT t
'rotating
ar
(0) = SIN(ob
(act_ob
, 15)) * COS(ob
(act_ob
, 14)): ar
(1) = SIN(ob
(act_ob
, 15)) * SIN(ob
(act_ob
, 14)): ar
(2) = COS(ob
(act_ob
, 15)) poss(t) = ob(act_ob, 4 + t) + ar(t) * ob(act_ob, 16)
IF poss
(t
) < 0 THEN poss
(t
) = poss
(t
) + dim_s
IF poss
(t
) > dim_s
THEN poss
(t
) = poss
(t
) - dim_s
re = 0
dis2 = (ob(an, 3) + ob(act_ob, 3))
dis1
= SQR((poss
(0) - ob
(an
, 4)) ^ 2 + (poss
(1) - ob
(an
, 5)) ^ 2 + (poss
(2) - ob
(an
, 6)) ^ 2)
ob
(act_ob
, 14) = 360 * RND(1) 'radA arrow random ob
(act_ob
, 15) = 360 * RND(1) 'radB arrow random ob
(act_ob
, 16) = sp_min
+ (sp_max
- sp_min
) * RND(1) 'random speed FOR t
= 7 TO 9: ob
(act_ob
, t
) = rot_min
+ (rot_max
- rot_min
) * RND(1):
NEXT t
'random rotating arrow,speed
FOR t
= 0 TO 2: ob
(act_ob
, 4 + t
) = poss
(t
):
NEXT t