' Meta
XSize = 30
YSize = 30
XCells = 30
YCells = 30
NPC
= .1 * SQR(XCells
* YCells
)
ChargeCount = 1
Charges(ChargeCount).Center.x = 0
Charges(ChargeCount).Center.y = 0
Charges(ChargeCount).Radial.x = .05
Charges(ChargeCount).Radial.y = .05
Charges(ChargeCount).Angular.x = 0
Charges(ChargeCount).Angular.y = 0
VectorField(i, j).Center.x = (1 / 2) * XSize * (2 * i - XCells) - XSize / 2
VectorField(i, j).Center.y = (1 / 2) * YSize * (2 * j - YCells) - YSize / 2
Particles(i, j, k).Shade = Lime
Particles
(i
, j
, k
).Displacement.x
= XSize
* (RND - .5) Particles
(i
, j
, k
).Displacement.y
= YSize
* (RND - .5)
Charges
(ChargeCount
).Center.x
= (x
- _WIDTH / 2) Charges
(ChargeCount
).Center.y
= (-y
+ _HEIGHT / 2)
Charges(ChargeCount).Radial.x = .05
Charges(ChargeCount).Radial.y = .05
Charges(ChargeCount).Angular.x = 0
Charges(ChargeCount).Angular.y = 0
Charges(ChargeCount).Radial.x = -.05
Charges(ChargeCount).Radial.y = -.05
Charges(ChargeCount).Angular.x = 0
Charges(ChargeCount).Angular.y = 0
Charges(ChargeCount).Radial.x = .05
Charges(ChargeCount).Radial.y = -.05
Charges(ChargeCount).Angular.x = 0
Charges(ChargeCount).Angular.y = 0
Charges(ChargeCount).Radial.x = -.05
Charges(ChargeCount).Radial.y = .05
Charges(ChargeCount).Angular.x = 0
Charges(ChargeCount).Angular.y = 0
Charges(ChargeCount).Radial.x = 0
Charges(ChargeCount).Radial.y = 0
Charges(ChargeCount).Angular.x = .05
Charges(ChargeCount).Angular.y = -.05
Charges(ChargeCount).Radial.x = 0
Charges(ChargeCount).Radial.y = 0
Charges(ChargeCount).Angular.x = -.05
Charges(ChargeCount).Angular.y = .05
ChargeCount = 1
ChargeCount = ChargeCount + 1
Charges(ChargeCount).Center.x = Charges(ChargeCount - 1).Center.x
Charges(ChargeCount).Center.y = Charges(ChargeCount - 1).Center.y
Charges(ChargeCount).Radial.x = Charges(ChargeCount - 1).Radial.x
Charges(ChargeCount).Radial.y = Charges(ChargeCount - 1).Radial.y
Charges(ChargeCount).Angular.x = Charges(ChargeCount - 1).Angular.x
Charges(ChargeCount).Angular.y = Charges(ChargeCount - 1).Angular.y
LOCATE 1, 1:
PRINT "Press 1-6 to change charge type. Press space to fix charge, 0 to clear." xc = VectorField(i, j).Center.x
yc = VectorField(i, j).Center.y
xd = 0
yd = 0
xx = Particles(i, j, k).Displacement.x + .1 * Particles(i, j, k).Velocity.x
yy = Particles(i, j, k).Displacement.y + .1 * Particles(i, j, k).Velocity.y
xd = -xx + XSize / 2
xd = -xx - XSize / 2
yd = -yy + YSize / 2
yd = -yy + -YSize / 2
Particles(i, j, k).Displacement.x = xx + xd
Particles(i, j, k).Displacement.y = yy + yd
CALL cpset
(xc
+ Particles
(i
, j
, k
).Displacement.x
, yc
+ Particles
(i
, j
, k
).Displacement.y
, Particles
(i
, j
, k
).Shade
)
xx = 0
yy = 0
dx = VectorField(i, j).Center.x - Charges(k).Center.x
dy = VectorField(i, j).Center.y - Charges(k).Center.y
d2 = 5000 / (dx * dx + dy * dy)
xx = xx + (Charges(k).Radial.x * dx * d2) + (Charges(k).Angular.x * dy * d2)
yy = yy + (Charges(k).Radial.y * dy * d2) + (Charges(k).Angular.y * dx * d2)
VectorField(i, j).Tangent.x = xx
VectorField(i, j).Tangent.y = yy
Particles(i, j, k).Velocity.x = VectorField(i, j).Tangent.x
Particles(i, j, k).Velocity.y = VectorField(i, j).Tangent.y