' Video.
'SCREEN _NEWIMAGE(640, 480, 32)
'SCREEN _NEWIMAGE(1024, 768, 32)
plotmode = 1
' Memory.
bignumber = 3000000
numparticleorig = bignumber
numparticlevisible = bignumber
numgroupvisible = 0
' Structure to store groups of particles.
' 0 Static
' 1 Standard Newtonian
' 2 Standard Rotor
' 3 Standard Hardcode
' 11 Forced Newtonian
' 12 Forced Rotor
' 31 Scatter
' 32 Sparks
DIM VectorGroup
(bignumber
/ 10) AS GroupElement
' Constant(s).
pi = 3.1415926536
ee = 2.7182818285
' Camera orientation vectors.
' Clipping planes.
DIM nearplane
(1 TO 4), farplane
(1 TO 4), rightplane
(1 TO 4), leftplane
(1 TO 4), topplane
(1 TO 4), bottomplane
(1 TO 4)
' Basis vectors defined in xyz three-space.
xhat(1) = 1: xhat(2) = 0: xhat(3) = 0
yhat(1) = 0: yhat(2) = 1: yhat(3) = 0
zhat(1) = 0: zhat(2) = 0: zhat(3) = 1
' Basis vectors projected in uv two-space.
DIM xhatp
(1 TO 2), yhatp
(1 TO 2), zhatp
(1 TO 2)
' Particle vectors defined in xyz three-space.
DIM vecorig
(numparticleorig
, 3) DIM vecorigvel
(numparticleorig
, 3) DIM vecorigrot
(numparticleorig
, 3) DIM vecorigacc
(numparticleorig
, 3) DIM vec
(numparticleorig
, 3) DIM vecvisible
(numparticlevisible
, 3) DIM vecvisiblecolor
(numparticlevisible
) AS LONG
' Particle vectors projected in uv two-space.
DIM vecpuv
(numparticleorig
, 1 TO 2) DIM vecvisiblepuv
(numparticlevisible
, 1 TO 2)
' Particle projections adjusted for screen uv two-space.
DIM vecpuvs
(numparticleorig
, 1 TO 2) DIM vecvisiblepuvs
(numparticlevisible
, 1 TO 2)
' State.
nearplane(4) = 1
farplane(4) = -100
rightplane(4) = 0 '*' fovd * (nhat(1) * rightplane(1) + nhat(2) * rightplane(2) + nhat(3) * rightplane(3))
leftplane(4) = 0
topplane(4) = 0
bottomplane(4) = 0
centerx = screenwidth / 2
centery = screenheight / 2
fovd = -256
numparticleorig = 0
numparticlevisible = 0
particleindex = 0
vecgroupcounter = 0
vecgroupindex = 0
speeddamp = 1 / 66 ' Rotation damper.
speedboost = 1.5 ' Linear boost.
timevar = 0
timestep = .001
camx = -40
camy = 30
camz = 40
uhat(1) = -.2078192: uhat(2) = -.9781672: uhat(3) = 0
vhat(1) = 0: vhat(2) = 0: vhat(3) = 1
toggletimeanimate = 1
toggleinvertmouse = -1
togglehud = -1
' Prime main loop.
' Begin main loop.
fps = 0
timevar = timevar + timestep
IF timevar
> 10 ^ 6 THEN timevar
= 0 flagredraw = 1
fps = fps + 1
flagredraw = -1
fpstimer = tt
fpsreport = fps
fps = 0
' Gosubs.
mouseprocess:
mx = 0
my = 0
IF toggleinvertmouse
= -1 THEN IF toggleinvertmouse
= -1 THEN mx = 0
my = 0
'MouseLB = _MOUSEBUTTON(1)
'MouseRB = _MOUSEBUTTON(2)
flagredraw = 1
'_keydown
keyprocess:
''': GOSUB normalize.screen.vectors
flagredraw = 1
uhat(1) = 0: uhat(2) = 1: uhat(3) = 0
vhat(1) = 0: vhat(2) = 0: vhat(3) = 1
uhat(1) = 0: uhat(2) = -1: uhat(3) = 0
vhat(1) = 0: vhat(2) = 0: vhat(3) = 1
uhat(1) = -1: uhat(2) = 0: uhat(3) = 0
vhat(1) = 0: vhat(2) = 0: vhat(3) = 1
uhat(1) = 1: uhat(2) = 0: uhat(3) = 0
vhat(1) = 0: vhat(2) = 0: vhat(3) = 1
uhat(1) = 1: uhat(2) = 0: uhat(3) = 0
vhat(1) = 0: vhat(2) = 1: vhat(3) = 0
uhat(1) = 0: uhat(2) = 1: uhat(3) = 0
vhat(1) = 1: vhat(2) = 0: vhat(3) = 0
farplane(4) = farplane(4) - 1
farplane(4) = farplane(4) + 1
togglehud = -togglehud
toggletimeanimate = -toggletimeanimate
toggleinvertmouse = -toggleinvertmouse
plotmode = -plotmode
PRINT #1, camx
, camy
, camz
PRINT #1, uhat
(1), uhat
(2), uhat
(3) PRINT #1, vhat
(1), vhat
(2), vhat
(3) explodex
= camx
- nhat
(1) * (1 - .1 * RND) * 60 explodey
= camy
- nhat
(2) * (1 - .1 * RND) * 60 explodez
= camz
- nhat
(3) * (1 - .1 * RND) * 60 VectorGroup(closestgroup).ContentType = 31
FOR particleindex
= VectorGroup
(closestgroup
).FirstParticle
TO VectorGroup
(closestgroup
).LastParticle
vecorigvel
(particleindex
, 1) = (RND - .5) * 20 vecorigvel
(particleindex
, 2) = (RND - .5) * 20 vecorigvel
(particleindex
, 3) = (RND - .5) * 20 vecorigacc(particleindex, 3) = -30
VectorGroup
(closestgroup
).EventTimer
= TIMER explodex = VectorGroup(closestgroup).COMx
explodey = VectorGroup(closestgroup).COMy
explodez = VectorGroup(closestgroup).COMz
p = VectorGroup(closestgroup).Pointer
l = VectorGroup(closestgroup).Lagger
VectorGroup(l).Pointer = p
VectorGroup(p).Lagger = l
'determine last object id
p = 1
k = VectorGroup(p).Identity
p = VectorGroup(k).Pointer
lastobjectid = k
VectorGroup(lastobjectid).Pointer = -999
'determine last object id
p = 1
k = VectorGroup(p).Identity
p = VectorGroup(k).Pointer
lastobjectid = k
particleindex = VectorGroup(lastobjectid).LastParticle
'create new group
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = -999
VectorGroup(vecgroupindex).Lagger = lastobjectid
VectorGroup(vecgroupindex).ContentName = "Block"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = camx
+ -40 * nhat
(1) + RND * tilesize
/ 2 vecorig
(particleindex
, 2) = camy
+ -40 * nhat
(2) + RND * tilesize
/ 2 vecorig
(particleindex
, 3) = camz
+ -40 * nhat
(3) + RND * tilesize
/ 2 veccolor(particleindex) = Lime
veccolor(particleindex) = Purple
VectorGroup(vecgroupindex).LastParticle = particleindex
'connect new group to last group
VectorGroup(lastobjectid).Pointer = vecgroupindex
convert:
' Convert graphics from uv-cartesian coordinates to monitor coordinates.
x0 = x: y0 = y
x = x0 + centerx
y = -y0 + centery
rotate.uhat.plus:
uhat(1) = uhat(1) + nhat(1) * speeddamp
uhat(2) = uhat(2) + nhat(2) * speeddamp
uhat(3) = uhat(3) + nhat(3) * speeddamp
rotate.uhat.minus:
uhat(1) = uhat(1) - nhat(1) * speeddamp
uhat(2) = uhat(2) - nhat(2) * speeddamp
uhat(3) = uhat(3) - nhat(3) * speeddamp
rotate.vhat.plus:
vhat(1) = vhat(1) + nhat(1) * speeddamp
vhat(2) = vhat(2) + nhat(2) * speeddamp
vhat(3) = vhat(3) + nhat(3) * speeddamp
rotate.vhat.minus:
vhat(1) = vhat(1) - nhat(1) * speeddamp
vhat(2) = vhat(2) - nhat(2) * speeddamp
vhat(3) = vhat(3) - nhat(3) * speeddamp
rotate.counterclockwise:
v1 = vhat(1)
v2 = vhat(2)
v3 = vhat(3)
vhat(1) = vhat(1) + uhat(1) * speeddamp
vhat(2) = vhat(2) + uhat(2) * speeddamp
vhat(3) = vhat(3) + uhat(3) * speeddamp
uhat(1) = uhat(1) - v1 * speeddamp
uhat(2) = uhat(2) - v2 * speeddamp
uhat(3) = uhat(3) - v3 * speeddamp
rotate.clockwise:
v1 = vhat(1)
v2 = vhat(2)
v3 = vhat(3)
vhat(1) = vhat(1) - uhat(1) * speeddamp
vhat(2) = vhat(2) - uhat(2) * speeddamp
vhat(3) = vhat(3) - uhat(3) * speeddamp
uhat(1) = uhat(1) + v1 * speeddamp
uhat(2) = uhat(2) + v2 * speeddamp
uhat(3) = uhat(3) + v3 * speeddamp
strafe.camera.uhat.plus:
camx = camx + uhat(1) * speedboost
camy = camy + uhat(2) * speedboost
camz = camz + uhat(3) * speedboost
strafe.camera.uhat.minus:
camx = camx - uhat(1) * speedboost
camy = camy - uhat(2) * speedboost
camz = camz - uhat(3) * speedboost
strafe.camera.vhat.plus:
camx = camx + vhat(1) * speedboost
camy = camy + vhat(2) * speedboost
camz = camz + vhat(3) * speedboost
strafe.camera.vhat.minus:
camx = camx - vhat(1) * speedboost
camy = camy - vhat(2) * speedboost
camz = camz - vhat(3) * speedboost
strafe.camera.nhat.plus:
camx = camx + nhat(1) * speedboost
camy = camy + nhat(2) * speedboost
camz = camz + nhat(3) * speedboost
strafe.camera.nhat.minus:
camx = camx - nhat(1) * speedboost
camy = camy - nhat(2) * speedboost
camz = camz - nhat(3) * speedboost
uhatmag
= SQR(uhat
(1) ^ 2 + uhat
(2) ^ 2 + uhat
(3) ^ 2)uhat(1) = uhat(1) / uhatmag: uhat(2) = uhat(2) / uhatmag: uhat(3) = uhat(3) / uhatmag
vhatmag
= SQR(vhat
(1) ^ 2 + vhat
(2) ^ 2 + vhat
(3) ^ 2)vhat(1) = vhat(1) / vhatmag: vhat(2) = vhat(2) / vhatmag: vhat(3) = vhat(3) / vhatmag
uhatdotvhat = uhat(1) * vhat(1) + uhat(2) * vhat(2) + uhat(3) * vhat(3)
BEEP ' ... if vectors are somenow not normalized. This has never happened. uhat(1) = 0.8251367: uhat(2) = -0.564903: uhat(3) = -0.005829525
vhat(1) = 0.065519: vhat(2) = 0.08544215: vhat(3) = 0.9941866
' The normal vector points toward the eye.
nhat(1) = uhat(2) * vhat(3) - uhat(3) * vhat(2)
nhat(2) = uhat(3) * vhat(1) - uhat(1) * vhat(3)
nhat(3) = uhat(1) * vhat(2) - uhat(2) * vhat(1)
nhatmag
= SQR(nhat
(1) ^ 2 + nhat
(2) ^ 2 + nhat
(3) ^ 2)nhat(1) = nhat(1) / nhatmag: nhat(2) = nhat(2) / nhatmag: nhat(3) = nhat(3) / nhatmag
redraw:
GOSUB calculate.clippingplanes
' Project the three-space basis vectors onto the screen plane.
xhatp(1) = xhat(1) * uhat(1) + xhat(2) * uhat(2) + xhat(3) * uhat(3)
xhatp(2) = xhat(1) * vhat(1) + xhat(2) * vhat(2) + xhat(3) * vhat(3)
yhatp(1) = yhat(1) * uhat(1) + yhat(2) * uhat(2) + yhat(3) * uhat(3)
yhatp(2) = yhat(1) * vhat(1) + yhat(2) * vhat(2) + yhat(3) * vhat(3)
zhatp(1) = zhat(1) * uhat(1) + zhat(2) * uhat(2) + zhat(3) * uhat(3)
zhatp(2) = zhat(1) * vhat(1) + zhat(2) * vhat(2) + zhat(3) * vhat(3)
GOSUB compute.visible.groups
compute.visible.groups:
numparticlevisible = 0
numgroupvisible = 0
closestdist2 = 10000 ^ 2
closestgroup = 1
ci = -1
cf = -1
k = 1
k = VectorGroup(k).Identity
xcom = VectorGroup(k).COMx
ycom = VectorGroup(k).COMy
zcom = VectorGroup(k).COMz
thetype = VectorGroup(k).ContentType
dist2 = (camx - xcom) ^ 2 + (camy - ycom) ^ 2 + (camz - zcom) ^ 2
IF dist2
< farplane
(4) ^ 2 THEN
groupinview = 1
IF (xcom
- camx
) * nearplane
(1) + (ycom
- camy
) * nearplane
(2) + (zcom
- camz
) * nearplane
(3) - nearplane
(4) < 0 THEN groupinview
= 0 'IF (xcom - camx) * farplane(1) + (ycom - camy) * farplane(2) + (zcom - camz) * farplane(3) - farplane(4) < 0 THEN groupinview = 0
IF (xcom
- camx
) * rightplane
(1) + (ycom
- camy
) * rightplane
(2) + (zcom
- camz
) * rightplane
(3) - rightplane
(4) < 0 THEN groupinview
= 0 IF (xcom
- camx
) * leftplane
(1) + (ycom
- camy
) * leftplane
(2) + (zcom
- camz
) * leftplane
(3) - leftplane
(4) < 0 THEN groupinview
= 0 IF (xcom
- camx
) * topplane
(1) + (ycom
- camy
) * topplane
(2) + (zcom
- camz
) * topplane
(3) - topplane
(4) < 0 THEN groupinview
= 0 IF (xcom
- camx
) * bottomplane
(1) + (ycom
- camy
) * bottomplane
(2) + (zcom
- camz
) * bottomplane
(3) - bottomplane
(4) < 0 THEN groupinview
= 0
numgroupvisible = numgroupvisible + 1
vecgroupindex = k
IF dist2
< closestdist2
AND thetype
< 30 THEN closestdist2 = dist2
closestgroup = k
IF k
= closestgroup
THEN ci
= numparticlevisible
FOR i
= VectorGroup
(k
).FirstParticle
TO VectorGroup
(k
).LastParticle
vec(i, 1) = vecorig(i, 1) - camx
vec(i, 2) = vecorig(i, 2) - camy
vec(i, 3) = vecorig(i, 3) - camz
GOSUB clip.particle.viewplanes
IF k
= closestgroup
THEN cf
= numparticlevisible
' Force animation regardless of distance from camera.
vecgroupindex = k
' Force animation regardless of distance from camera.
vecgroupindex = k
k = VectorGroup(k).Pointer
k = VectorGroup(k).Identity
vecvisiblecolor(i) = Yellow
clip.particle.viewplanes:
' requires i
particleinview = 1
fogswitch = -1
' Perform standard view plane clipping and implement fog effect.
IF vec
(i
, 1) * nearplane
(1) + vec
(i
, 2) * nearplane
(2) + vec
(i
, 3) * nearplane
(3) - nearplane
(4) < 0 THEN particleinview
= 0 IF vec
(i
, 1) * farplane
(1) + vec
(i
, 2) * farplane
(2) + vec
(i
, 3) * farplane
(3) - farplane
(4) < 0 THEN particleinview
= 0 IF vec
(i
, 1) * farplane
(1) + vec
(i
, 2) * farplane
(2) + vec
(i
, 3) * farplane
(3) - farplane
(4) * .9 < 0 THEN fogswitch
= 1 IF vec
(i
, 1) * rightplane
(1) + vec
(i
, 2) * rightplane
(2) + vec
(i
, 3) * rightplane
(3) - rightplane
(4) < 0 THEN particleinview
= 0 IF vec
(i
, 1) * leftplane
(1) + vec
(i
, 2) * leftplane
(2) + vec
(i
, 3) * leftplane
(3) - leftplane
(4) < 0 THEN particleinview
= 0 IF vec
(i
, 1) * topplane
(1) + vec
(i
, 2) * topplane
(2) + vec
(i
, 3) * topplane
(3) - topplane
(4) < 0 THEN particleinview
= 0 IF vec
(i
, 1) * bottomplane
(1) + vec
(i
, 2) * bottomplane
(2) + vec
(i
, 3) * bottomplane
(3) - bottomplane
(4) < 0 THEN particleinview
= 0 numparticlevisible = numparticlevisible + 1
vecvisible(numparticlevisible, 1) = vec(i, 1)
vecvisible(numparticlevisible, 2) = vec(i, 2)
vecvisible(numparticlevisible, 3) = vec(i, 3)
vecvisiblecolor(numparticlevisible) = veccolor(i)
IF fogswitch
= 1 THEN vecvisiblecolor
(numparticlevisible
) = Gray
project.particles:
' Project vectors onto the screen plane.
FOR i
= 1 TO numparticlevisible
vecvisibledotnhat = vecvisible(i, 1) * nhat(1) + vecvisible(i, 2) * nhat(2) + vecvisible(i, 3) * nhat(3)
vecvisiblepuv(i, 1) = vecvisible(i, 1) * uhat(1) + vecvisible(i, 2) * uhat(2) + vecvisible(i, 3) * uhat(3)
vecvisiblepuv(i, 2) = vecvisible(i, 1) * vhat(1) + vecvisible(i, 2) * vhat(2) + vecvisible(i, 3) * vhat(3)
vecvisiblepuvs(i, 1) = vecvisiblepuv(i, 1) * fovd / vecvisibledotnhat
vecvisiblepuvs(i, 2) = vecvisiblepuv(i, 2) * fovd / vecvisibledotnhat
' Redraw compass.
x
= 30 * xhatp
(1): y
= 30 * xhatp
(2):
GOSUB convert
LINE (centerx
, centery
)-(x
, y
), Red
x
= 30 * yhatp
(1): y
= 30 * yhatp
(2):
GOSUB convert
LINE (centerx
, centery
)-(x
, y
), Green
x
= 30 * zhatp
(1): y
= 30 * zhatp
(2):
GOSUB convert
LINE (centerx
, centery
)-(x
, y
), Blue
a$
= "SPACE = Hide Info":
LOCATE (screenheight
/ 16) - 3, (screenwidth
/ 8) / 2 - LEN(a$
) / 2:
PRINT a$
a$
= "You See: " + LTRIM$(RTRIM$(VectorGroup
(closestgroup
).ContentName
)):
LOCATE (screenheight
/ 16) - 3, (screenwidth
/ 8) / 2 - LEN(a$
) / 2:
PRINT a$
calculate.clippingplanes:
' Calculate normal vectors to all clipping planes.
nearplane(1) = -nhat(1)
nearplane(2) = -nhat(2)
nearplane(3) = -nhat(3)
farplane(1) = nhat(1)
farplane(2) = nhat(2)
farplane(3) = nhat(3)
rightplane(1) = (screenheight / 2) * fovd * uhat(1) - (screenheight / 2) * (screenwidth / 2) * nhat(1)
rightplane(2) = (screenheight / 2) * fovd * uhat(2) - (screenheight / 2) * (screenwidth / 2) * nhat(2)
rightplane(3) = (screenheight / 2) * fovd * uhat(3) - (screenheight / 2) * (screenwidth / 2) * nhat(3)
mag
= SQR((rightplane
(1)) ^ 2 + (rightplane
(2)) ^ 2 + (rightplane
(3)) ^ 2)rightplane(1) = rightplane(1) / mag
rightplane(2) = rightplane(2) / mag
rightplane(3) = rightplane(3) / mag
leftplane(1) = -(screenheight / 2) * fovd * uhat(1) - (screenheight / 2) * (screenwidth / 2) * nhat(1)
leftplane(2) = -(screenheight / 2) * fovd * uhat(2) - (screenheight / 2) * (screenwidth / 2) * nhat(2)
leftplane(3) = -(screenheight / 2) * fovd * uhat(3) - (screenheight / 2) * (screenwidth / 2) * nhat(3)
mag
= SQR((leftplane
(1)) ^ 2 + (leftplane
(2)) ^ 2 + (leftplane
(3)) ^ 2)leftplane(1) = leftplane(1) / mag
leftplane(2) = leftplane(2) / mag
leftplane(3) = leftplane(3) / mag
topplane(1) = (screenwidth / 2) * fovd * vhat(1) - (screenheight / 2) * (screenwidth / 2) * nhat(1)
topplane(2) = (screenwidth / 2) * fovd * vhat(2) - (screenheight / 2) * (screenwidth / 2) * nhat(2)
topplane(3) = (screenwidth / 2) * fovd * vhat(3) - (screenheight / 2) * (screenwidth / 2) * nhat(3)
mag
= SQR((topplane
(1)) ^ 2 + (topplane
(2)) ^ 2 + (topplane
(3)) ^ 2)topplane(1) = topplane(1) / mag
topplane(2) = topplane(2) / mag
topplane(3) = topplane(3) / mag
bottomplane(1) = -(screenwidth / 2) * fovd * vhat(1) - (screenheight / 2) * (screenwidth / 2) * nhat(1)
bottomplane(2) = -(screenwidth / 2) * fovd * vhat(2) - (screenheight / 2) * (screenwidth / 2) * nhat(2)
bottomplane(3) = -(screenwidth / 2) * fovd * vhat(3) - (screenheight / 2) * (screenwidth / 2) * nhat(3)
mag
= SQR((bottomplane
(1)) ^ 2 + (bottomplane
(2)) ^ 2 + (bottomplane
(3)) ^ 2)bottomplane(1) = bottomplane(1) / mag
bottomplane(2) = bottomplane(2) / mag
bottomplane(3) = bottomplane(3) / mag
plot.particles:
FOR i
= 1 TO numparticlevisible
- 1 x
= vecvisiblepuvs
(i
, 1): y
= vecvisiblepuvs
(i
, 2):
GOSUB convert: x1
= x: y1
= y
x
= vecvisiblepuvs
(i
+ 1, 1): y
= vecvisiblepuvs
(i
+ 1, 2):
GOSUB convert: x2
= x: y2
= y
IF ((x2
- x1
) ^ 2 + (y2
- y1
) ^ 2) < 225 THEN LINE (x1
, y1
)-(x2
, y2
), vecvisiblecolor
(i
) LINE (x1
, y1
)-(x2
, y2
), vecvisiblecolor
(i
), B
CIRCLE (x1
, y1
), 1, vecvisiblecolor
(i
)
' Data.
initialize.objects:
particleindex = 0
vecgroupcounter = 0
gridsize = 550
tilesize = 15
'__AAA
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "__AAA"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig(particleindex, 1) = -1000
vecorig(particleindex, 2) = -1000
vecorig(particleindex, 3) = -1000
veccolor(particleindex) = White
VectorGroup(vecgroupindex).LastParticle = particleindex
'Clock Face (Rolex)
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Clock Face (Rolex)"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = 40 + r
* COS(q
) vecorig(particleindex, 2) = -20 + r
vecorig
(particleindex
, 3) = 40 + r
* SIN(q
) veccolor(particleindex) = DarkSlateGray
VectorGroup(vecgroupindex).LastParticle = particleindex
'Clock Hands
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Clock Hands"
VectorGroup(vecgroupindex).ContentType = 3
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
phase = pi / 2
hcol(1) = Gold
hcol(2) = Lime
hcol(3) = OrangeRed
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = 40 + r
* COS(hand
(q
) + phase
) vecorig(particleindex, 2) = -10
vecorig
(particleindex
, 3) = 40 + r
* SIN(hand
(q
) + phase
) veccolor(particleindex) = hcol(q)
VectorGroup(vecgroupindex).LastParticle = particleindex
'Dirt
h = 5
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Dirt"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 2) = j
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = -(w
- 1) * 70 - RND * 70 veccolor(particleindex) = DarkGoldenRod
veccolor(particleindex) = SaddleBrown
veccolor(particleindex) = Sienna
VectorGroup(vecgroupindex).LastParticle = particleindex
'Grass and Puddles
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Grass and Puddles"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 2) = j
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = .5 + 1 * COS((i
- 15) * .08) - 1 * COS((j
- 6) * .12) IF vecorig
(particleindex
, 3) > 0 THEN veccolor(particleindex) = Green
veccolor(particleindex) = ForestGreen
veccolor(particleindex) = LightSeaGreen
veccolor(particleindex) = Blue
VectorGroup(vecgroupindex).LastParticle = particleindex
'Grave
thickness = 2.5
span = 20
height = 30
crux = 22
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Grave"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
FOR i
= -thickness
TO thickness
STEP thickness
/ 2 FOR j
= -thickness
TO thickness
STEP thickness
/ 2 particleindex = particleindex + 1
vecorig
(particleindex
, 1) = xloc
+ i
+ (RND - .5) * 2 vecorig
(particleindex
, 2) = yloc
+ j
+ (RND - .5) * 2 vecorig
(particleindex
, 3) = k
+ (RND - .5) * 2 veccolor(particleindex) = SlateGray
veccolor(particleindex) = DarkGray
VectorGroup(vecgroupindex).LastParticle = particleindex
FOR j
= -span
/ 2 TO -thickness
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Grave"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
FOR k
= -thickness
TO thickness
STEP thickness
/ 2 FOR i
= -thickness
TO thickness
STEP thickness
/ 2 particleindex = particleindex + 1
vecorig
(particleindex
, 1) = xloc
+ i
+ (RND - .5) * 2 vecorig
(particleindex
, 2) = yloc
+ j
+ (RND - .5) * 2 vecorig
(particleindex
, 3) = crux
+ k
+ (RND - .5) * 2 veccolor(particleindex) = SlateGray
veccolor(particleindex) = DarkGray
VectorGroup(vecgroupindex).LastParticle = particleindex
FOR j
= thickness
TO span
/ 2 vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Grave"
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
FOR k
= -thickness
TO thickness
STEP thickness
/ 2 FOR i
= -thickness
TO thickness
STEP thickness
/ 2 particleindex = particleindex + 1
vecorig
(particleindex
, 1) = xloc
+ i
+ (RND - .5) * 2 vecorig
(particleindex
, 2) = yloc
+ j
+ (RND - .5) * 2 vecorig
(particleindex
, 3) = crux
+ k
+ (RND - .5) * 2 veccolor(particleindex) = SlateGray
veccolor(particleindex) = DarkGray
VectorGroup(vecgroupindex).LastParticle = particleindex
'Heaven's Bottom Layer
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Heaven's Bottom Layer"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 2) = j
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = 420 - RND veccolor(particleindex) = BlueViolet
veccolor(particleindex) = Cyan
VectorGroup(vecgroupindex).LastParticle = particleindex
'Hell Spawn
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Hell Spawn"
VectorGroup(vecgroupindex).ContentType = 3
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * tilesize
/ 5 vecorig
(particleindex
, 2) = j
+ RND * tilesize
/ 5 vecorig
(particleindex
, 3) = -350 - RND * 70 veccolor(particleindex) = Red
veccolor(particleindex) = DarkGoldenRod
VectorGroup(vecgroupindex).LastParticle = particleindex
'Icewall East
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Icewall East"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig(particleindex, 1) = gridsize
vecorig
(particleindex
, 2) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = j
+ RND * h
- RND * h
veccolor(particleindex) = White
veccolor(particleindex) = Ivory
VectorGroup(vecgroupindex).LastParticle = particleindex
'Icewall South
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Icewall South"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig(particleindex, 1) = -gridsize
vecorig
(particleindex
, 2) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = j
+ RND * h
- RND * h
veccolor(particleindex) = White
veccolor(particleindex) = Ivory
VectorGroup(vecgroupindex).LastParticle = particleindex
'Icewall North
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Icewall North"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig(particleindex, 2) = gridsize
vecorig
(particleindex
, 3) = j
+ RND * h
- RND * h
veccolor(particleindex) = White
veccolor(particleindex) = Ivory
VectorGroup(vecgroupindex).LastParticle = particleindex
'Icewall West
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Icewall West"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig(particleindex, 2) = -gridsize
vecorig
(particleindex
, 3) = j
+ RND * h
- RND * h
veccolor(particleindex) = White
veccolor(particleindex) = Ivory
VectorGroup(vecgroupindex).LastParticle = particleindex
'Lake of Fire
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Lake of Fire"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 2) = j
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = -350 - 70 - RND veccolor(particleindex) = Red
veccolor(particleindex) = Indigo
VectorGroup(vecgroupindex).LastParticle = particleindex
'Megalith
ctrx = -90
ctry = -320
ctrz = 4
w = 8
h = 256
dens = 100
FOR i
= -h
/ 20 + k
/ 20 TO h
/ 20 - k
/ 20 STEP w
FOR j
= -h
/ 20 + k
/ 20 TO h
/ 20 - k
/ 20 STEP w
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Megalith"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = ctrx
+ i
+ (RND - .5) * w
vecorig
(particleindex
, 2) = ctry
+ j
+ (RND - .5) * w
vecorig
(particleindex
, 3) = ctrz
+ k
+ (RND - .5) * w
veccolor(particleindex) = Cyan
veccolor(particleindex) = Teal
VectorGroup(vecgroupindex).LastParticle = particleindex
'Moon
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Moon"
VectorGroup(vecgroupindex).ContentType = 2
VectorGroup(vecgroupindex).CORx = 0
VectorGroup(vecgroupindex).CORy = 0
VectorGroup(vecgroupindex).CORz = 90
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
radius = 4
au = 60
dx = (2 * pi / radius) * .05
dy = (2 * pi / radius) * .05
xl = 0: xr = 2 * pi
yl = 0: yr = pi
xrange
= 1 + INT((-xl
+ xr
) / dx
)yrange
= 1 + INT((-yl
+ yr
) / dy
) particleindex = particleindex + 1
theta = i * dx - dx
phi = j * dy - dy
vecorig
(particleindex
, 1) = au
+ radius
* SIN(phi
) * COS(theta
) vecorig
(particleindex
, 2) = radius
* SIN(phi
) * SIN(theta
) vecorig
(particleindex
, 3) = 90 + radius
* COS(phi
) vecorigrot(particleindex, 1) = 0
vecorigrot(particleindex, 2) = 0
vecorigrot(particleindex, 3) = 1
veccolor(particleindex) = Gray
veccolor(particleindex) = PaleGoldenRod
VectorGroup(vecgroupindex).LastParticle = particleindex
'Pyramid
ctrx = -90
ctry = -120
ctrz = 4
w = 8
h = 56
dens = 50
FOR i
= -h
/ 2 + k
/ 2 TO h
/ 2 - k
/ 2 STEP w
FOR j
= -h
/ 2 + k
/ 2 TO h
/ 2 - k
/ 2 STEP w
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Pyramid"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = ctrx
+ i
+ (RND - .5) * w
vecorig
(particleindex
, 2) = ctry
+ j
+ (RND - .5) * w
vecorig
(particleindex
, 3) = ctrz
+ k
+ (RND - .5) * w
veccolor(particleindex) = DarkGoldenRod
veccolor(particleindex) = GoldenRod
VectorGroup(vecgroupindex).LastParticle = particleindex
'Rain
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Rain"
VectorGroup(vecgroupindex).ContentType = 3
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * tilesize
vecorig
(particleindex
, 2) = j
+ RND * tilesize
vecorig
(particleindex
, 3) = RND * 70 veccolor(particleindex) = Aquamarine
veccolor(particleindex) = DodgerBlue
VectorGroup(vecgroupindex).LastParticle = particleindex
'Sky
h = 2
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Sky"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 2) = j
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = 70 + RND * h
- RND * h
veccolor(particleindex) = Snow
veccolor(particleindex) = RoyalBlue
VectorGroup(vecgroupindex).LastParticle = particleindex
'Snake?
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Snake?"
VectorGroup(vecgroupindex).ContentType = 3
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = -10 + 5 * COS(i
) vecorig
(particleindex
, 2) = -20 + 5 * SIN(i
) vecorig
(particleindex
, 3) = 25 - 3 * COS(6 * i
) * SIN(3 * i
) veccolor(particleindex) = Coral
VectorGroup(vecgroupindex).LastParticle = particleindex
'Sparks
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Sparks"
VectorGroup(vecgroupindex).ContentType = 32
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
u = 0
v = 0
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = RND - .5 vecorig
(particleindex
, 2) = RND - .5 vecorig
(particleindex
, 3) = 20 + RND - .5 vecorigvel
(particleindex
, 1) = 8 * (RND - .5) vecorigvel
(particleindex
, 2) = 8 * (RND - .5) vecorigvel
(particleindex
, 3) = 20 * RND vecorigacc(particleindex, 1) = 0
vecorigacc(particleindex, 2) = 0
vecorigacc(particleindex, 3) = -40
VectorGroup(vecgroupindex).LastParticle = particleindex
'Stars
h = 5
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Stars"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = i
+ RND * h
- RND * h
vecorig
(particleindex
, 2) = j
+ RND * h
- RND * h
vecorig
(particleindex
, 3) = w
* 70 + RND * 70 veccolor(particleindex) = GhostWhite
veccolor(particleindex) = White
veccolor(particleindex) = DarkGray
VectorGroup(vecgroupindex).LastParticle = particleindex
'Sun
radius = 10
dx = .0628
dy = .0628
xl = 0: xr = 2 * pi
yl = 0: yr = pi
xrange
= 1 + INT((-xl
+ xr
) / dx
)yrange
= 1 + INT((-yl
+ yr
) / dy
) vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Sun"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
theta = u * dx - dx
phi = v * dy - dy
vecorig
(particleindex
, 1) = radius
* SIN(phi
) * COS(theta
) vecorig
(particleindex
, 2) = radius
* SIN(phi
) * SIN(theta
) vecorig
(particleindex
, 3) = 90 + radius
* COS(phi
) veccolor(particleindex) = Sunglow
veccolor(particleindex) = SunsetOrange
VectorGroup(vecgroupindex).LastParticle = particleindex
'UFO!!!
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "UFO!!!"
VectorGroup(vecgroupindex).ContentType = 12
VectorGroup(vecgroupindex).CORx = 0
VectorGroup(vecgroupindex).CORy = 0
VectorGroup(vecgroupindex).CORz = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = -90 + r
* COS(q
) vecorig
(particleindex
, 2) = -120 + r
* SIN(q
) vecorig(particleindex, 3) = 100 + r - 12
vecorigrot(particleindex, 1) = 0
vecorigrot(particleindex, 2) = 0
vecorigrot(particleindex, 3) = 1
veccolor(particleindex) = HotPink
particleindex = particleindex + 1
vecorig
(particleindex
, 1) = -90 + r
* COS(q
) vecorig
(particleindex
, 2) = -120 + r
* SIN(q
) vecorig(particleindex, 3) = 100 - r + 12
vecorigrot(particleindex, 1) = 0
vecorigrot(particleindex, 2) = 0
vecorigrot(particleindex, 3) = 1
veccolor(particleindex) = Red
r = 5
h = 30
IF xx
^ 2 + yy
^ 2 < r
^ 2 THEN particleindex = particleindex + 1
vecorig(particleindex, 1) = -90 + xx
vecorig(particleindex, 2) = -120 + yy
vecorig
(particleindex
, 3) = 100 - RND * h
vecorigrot(particleindex, 1) = 0
vecorigrot(particleindex, 2) = 0
vecorigrot(particleindex, 3) = 1
veccolor(particleindex) = Aquamarine
veccolor(particleindex) = Lime
VectorGroup(vecgroupindex).LastParticle = particleindex
'Waves or Particles? (1)
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Waves or Particles?"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig(particleindex, 1) = 70 + 7 * u
vecorig
(particleindex
, 2) = 80 + 1 * COS((u
^ 2 - v
^ 2)) vecorig(particleindex, 3) = 10 + 7 * v
IF vecorig
(particleindex
, 2) < 80 THEN veccolor(particleindex) = DarkBlue
veccolor(particleindex) = DeepPink
VectorGroup(vecgroupindex).LastParticle = particleindex
'Waves or Particles? (2)
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "Waves or Particles?"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig(particleindex, 1) = -7 * u
vecorig
(particleindex
, 2) = 80 + 1 * COS(2 * ((u
- 7) ^ 2 - (v
- 5) ^ 2)) vecorig(particleindex, 3) = 10 + 7 * v
IF vecorig
(particleindex
, 2) < 80 THEN veccolor(particleindex) = Magenta
veccolor(particleindex) = Chocolate
VectorGroup(vecgroupindex).LastParticle = particleindex
'File
recordtype = 0
IF xx
= -111111 AND yy
= -111111 AND zz
= -111111 AND co
= -111111 THEN ' Next record begins a group. recordtype = 111111
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = vecgroupindex + 1
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = n$
VectorGroup(vecgroupindex).ContentType = m
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
IF xx
= -222222 AND yy
= -222222 AND zz
= -222222 AND co
= -222222 THEN ' Next record is position offset for entire group. recordtype = 222222
vecorigvel(particleindex, 1) = 0 'xx
vecorigvel(particleindex, 2) = 0 'yy
vecorigvel(particleindex, 3) = 0 'zz
IF xx
= -333333 AND yy
= -333333 AND zz
= -333333 AND co
= -333333 THEN ' Next record is previous particle's linear velocity vector. recordtype = 333333
vecorigvel(particleindex, 1) = xx
vecorigvel(particleindex, 2) = yy
vecorigvel(particleindex, 3) = zz
IF xx
= -444444 AND yy
= -444444 AND zz
= -444444 AND co
= -444444 THEN ' Next record is previous particle's linear acceleration vector. recordtype = 444444
vecorigacc(particleindex, 1) = xx
vecorigacc(particleindex, 2) = yy
vecorigacc(particleindex, 3) = zz
IF xx
= -555555 AND yy
= -555555 AND zz
= -555555 AND co
= -555555 THEN ' Next record is rotation point for entire group. recordtype = 555555
VectorGroup(vecgroupindex).CORx = xx
VectorGroup(vecgroupindex).CORy = yy
VectorGroup(vecgroupindex).CORz = zz
IF xx
= -666666 AND yy
= -666666 AND zz
= -666666 AND co
= -666666 THEN ' Next record is previous particle's angular velocity vector. recordtype = 666666
vecorigrot(particleindex, 1) = xx
vecorigrot(particleindex, 2) = yy
vecorigrot(particleindex, 3) = zz
IF xx
= -999999 AND yy
= -999999 AND zz
= -999999 AND co
= -999999 THEN ' Previous record was last in group. recordtype = 999999
VectorGroup(vecgroupindex).LastParticle = particleindex
IF xx
= -123123 AND yy
= -123123 AND zz
= -123123 AND co
= -123123 THEN ' Next record sets camera position. recordtype = 123123
camx = xx
camy = yy
camz = zz
IF xx
= -234234 AND yy
= -234234 AND zz
= -234234 AND co
= -234234 THEN ' Next two records set camera orientation. recordtype = 23434
uhat(1) = xx
uhat(2) = yy
uhat(3) = zz
vhat(1) = xx
vhat(2) = yy
vhat(3) = zz
IF recordtype
= 0 THEN ' Not a special record. Store position and color. particleindex = particleindex + 1
vecorig(particleindex, 1) = xx
vecorig(particleindex, 2) = yy
vecorig(particleindex, 3) = zz
veccolor(particleindex) = Black
veccolor(particleindex) = Blue
veccolor(particleindex) = Green
veccolor(particleindex) = Cyan
veccolor(particleindex) = Red
veccolor(particleindex) = Purple
veccolor(particleindex) = Orange
veccolor(particleindex) = LightGray
veccolor(particleindex) = DarkGray
veccolor(particleindex) = LightBlue
veccolor(particleindex) = LightGreen
veccolor(particleindex) = LightCyan
veccolor(particleindex) = OrangeRed 'lightred
veccolor(particleindex) = Violet 'lightpurple
veccolor(particleindex) = Yellow
veccolor(particleindex) = White
veccolor(particleindex) = White
'__ZZZ
vecgroupcounter = vecgroupcounter + 1
vecgroupindex = vecgroupcounter
VectorGroup(vecgroupindex).Identity = vecgroupindex
VectorGroup(vecgroupindex).Pointer = -999
VectorGroup(vecgroupindex).Lagger = vecgroupindex - 1
VectorGroup(vecgroupindex).ContentName = "__ZZZ"
VectorGroup(vecgroupindex).ContentType = 0
VectorGroup(vecgroupindex).FirstParticle = particleindex + 1
particleindex = particleindex + 1
vecorig(particleindex, 1) = -1000
vecorig(particleindex, 2) = -1000
vecorig(particleindex, 3) = -1000
veccolor(particleindex) = White
VectorGroup(vecgroupindex).LastParticle = particleindex
numparticleorig = particleindex
timeanimate:
thename$
= LTRIM$(RTRIM$(VectorGroup
(vecgroupindex
).ContentName
))IF thetype
= 31 THEN ' Scatter dt = timestep * 100
FOR particleindex
= VectorGroup
(vecgroupindex
).FirstParticle
TO VectorGroup
(vecgroupindex
).LastParticle
vecorigvel(particleindex, 1) = vecorigvel(particleindex, 1) + vecorigacc(particleindex, 1) * dt
vecorigvel(particleindex, 2) = vecorigvel(particleindex, 2) + vecorigacc(particleindex, 2) * dt
vecorigvel(particleindex, 3) = vecorigvel(particleindex, 3) + vecorigacc(particleindex, 3) * dt
vecorig(particleindex, 1) = vecorig(particleindex, 1) + vecorigvel(particleindex, 1) * dt
vecorig(particleindex, 2) = vecorig(particleindex, 2) + vecorigvel(particleindex, 2) * dt
vecorig(particleindex, 3) = vecorig(particleindex, 3) + vecorigvel(particleindex, 3) * dt
IF vecorig
(particleindex
, 3) < 0 THEN vecorig(particleindex, 3) = 0
vecorigvel(particleindex, 1) = vecorigvel(particleindex, 1) * .75
vecorigvel(particleindex, 2) = vecorigvel(particleindex, 2) * .75
vecorigvel(particleindex, 3) = -vecorigvel(particleindex, 3) * .5
VectorGroup(vecgroupindex).ContentName = "Destroyed " + VectorGroup(vecgroupindex).ContentName
VectorGroup(vecgroupindex).ContentType = 0
IF thetype
= 2 OR thetype
= 12 THEN ' Standard Rotor, Forced Rotor FOR particleindex
= VectorGroup
(vecgroupindex
).FirstParticle
TO VectorGroup
(vecgroupindex
).LastParticle
x = vecorig(particleindex, 1) - VectorGroup(vecgroupindex).CORx
y = vecorig(particleindex, 2) - VectorGroup(vecgroupindex).CORy
z = vecorig(particleindex, 3) - VectorGroup(vecgroupindex).CORz
ax = vecorigrot(particleindex, 1)
ay = vecorigrot(particleindex, 2)
az = vecorigrot(particleindex, 3)
da = timestep * az
xx = x
yy = y
x
= xx
* COS(da
) - yy
* SIN(da
) y
= xx
* SIN(da
) + yy
* COS(da
) da = timestep * ay
xx = x
zz = z
x
= xx
* COS(da
) + zz
* SIN(da
) z
= -xx
* SIN(da
) + zz
* COS(da
) da = timestep * ax
yy = y
zz = z
y
= yy
* COS(da
) - zz
* SIN(da
) z
= yy
* SIN(da
) + zz
* COS(da
) vecorig(particleindex, 1) = x + VectorGroup(vecgroupindex).CORx
vecorig(particleindex, 2) = y + VectorGroup(vecgroupindex).CORy
vecorig(particleindex, 3) = z + VectorGroup(vecgroupindex).CORz
IF thename$
= "Clock Hands" THEN pin = VectorGroup(vecgroupindex).FirstParticle
pin = pin + 1
vecorig
(pin
, 1) = 40 + r
* COS(hands
(q
, 1) + pi
/ 2) vecorig(pin, 2) = -10
vecorig
(pin
, 3) = 40 + r
* SIN(hands
(q
, 1) + pi
/ 2)IF thename$
= "Hell Spawn" THEN FOR i
= VectorGroup
(vecgroupindex
).FirstParticle
TO VectorGroup
(vecgroupindex
).LastParticle
vecorig(i, 3) = vecorig(i, 3) + .3
IF vecorig
(i
, 3) > -350 THEN vecorig
(i
, 3) = -350 - 70 FOR i
= VectorGroup
(vecgroupindex
).FirstParticle
TO VectorGroup
(vecgroupindex
).LastParticle
vecorig(i, 3) = vecorig(i, 3) - .3
IF vecorig
(i
, 3) < 0 THEN vecorig
(i
, 3) = 70 pin = VectorGroup(vecgroupindex).FirstParticle
t = timevar
vecorig
(pin
, 1) = -10 + 5 * COS(i
+ t
) vecorig
(pin
, 2) = -20 + 5 * SIN(i
+ t
) vecorig
(pin
, 3) = 25 - 3 * COS(6 * i
+ t
) * SIN(3 * i
+ t
) pin = pin + 1
dt = timestep * 100
FOR particleindex
= VectorGroup
(vecgroupindex
).FirstParticle
TO VectorGroup
(vecgroupindex
).LastParticle
vecorigvel(particleindex, 1) = vecorigvel(particleindex, 1) + vecorigacc(particleindex, 1) * dt
vecorigvel(particleindex, 2) = vecorigvel(particleindex, 2) + vecorigacc(particleindex, 2) * dt
vecorigvel(particleindex, 3) = vecorigvel(particleindex, 3) + vecorigacc(particleindex, 3) * dt
vecorig(particleindex, 1) = vecorig(particleindex, 1) + vecorigvel(particleindex, 1) * dt
vecorig(particleindex, 2) = vecorig(particleindex, 2) + vecorigvel(particleindex, 2) * dt
vecorig(particleindex, 3) = vecorig(particleindex, 3) + vecorigvel(particleindex, 3) * dt
IF vecorig
(particleindex
, 3) < 0 THEN vecorig(particleindex, 3) = 0
vecorigvel(particleindex, 1) = vecorigvel(particleindex, 1) * .75
vecorigvel(particleindex, 2) = vecorigvel(particleindex, 2) * .75
vecorigvel(particleindex, 3) = -vecorigvel(particleindex, 3) * .5
explode:
vecgroupindex = VectorGroup(1).Identity
FOR particleindex
= VectorGroup
(vecgroupindex
).FirstParticle
TO VectorGroup
(vecgroupindex
).LastParticle
vecorig(particleindex, 1) = explodex
vecorig(particleindex, 2) = explodey
vecorig(particleindex, 3) = explodez
vecorigvel
(particleindex
, 1) = (RND - .5) * 20 vecorigvel
(particleindex
, 2) = (RND - .5) * 20 vecorigvel
(particleindex
, 3) = (RND - .2) * 40 vecorigacc(particleindex, 3) = -30
vecgroupindex = VectorGroup(vecgroupindex).Pointer
vecgroupindex = VectorGroup(vecgroupindex).Identity
calccom:
VectorGroup(vecgroupindex).COMx = vecorig(particleindex, 1) + VectorGroup(vecgroupindex).COMx
VectorGroup(vecgroupindex).COMy = vecorig(particleindex, 2) + VectorGroup(vecgroupindex).COMy
VectorGroup(vecgroupindex).COMz = vecorig(particleindex, 3) + VectorGroup(vecgroupindex).COMz
adjustcom:
f = 1 + VectorGroup(vecgroupindex).LastParticle - VectorGroup(vecgroupindex).FirstParticle
VectorGroup(vecgroupindex).COMx = VectorGroup(vecgroupindex).COMx / f
VectorGroup(vecgroupindex).COMy = VectorGroup(vecgroupindex).COMy / f
VectorGroup(vecgroupindex).COMz = VectorGroup(vecgroupindex).COMz / f
resetcom:
VectorGroup(vecgroupindex).COMx = 0
VectorGroup(vecgroupindex).COMy = 0
VectorGroup(vecgroupindex).COMz = 0