/* Program goals:
2.22.2003 -in btown
-Emulate 2D particle-field interactions
-Upgradeable to 3D
Adjustments and effects:
-numParts: performance IP to square
-timeStep: time used to calc displacement of each frame,
time for each frame
-frameStep: Actual pause (ms) btewn frames
-forceFactor: larger means more inertia
-forcePower: exponent of distance
2.25.2003:
> working on tracker algorithm
PROB:
-Slight offset in offsets is divergent from
particle
CAUSE:
-The acceleration of the collective particles
overcomes the adjustment algorithm - the
offsets arnen't adding fast enough to keep up
with the body.
SOLN:
-Reexamine follower algorithm
-make adjustment for some average velocity, like have
a coefficient that is DP to velocity.
FIXED:
-simplified algorithm
> Optimized conditionals in update(g)
PROB: ?
- Eventually particles are divergent
CAUSE:
- energy of system increases due to invalid FORCE(dist) function
SOLN:
- use units, convert px to meters or Km and just use science instead
of minor adjustment tweaks.
> adjusting tracker to follow system center of mass
LATER: centerX = sum(m1*x1 m2*x2 ...)/sum(m1 m2 ...)
2.28.2003 -
Adding text input for forcePower variable.
3.13.2003 -
-Focus window by zooming out, instead of following one particle.
- the goal: keep all particles on the screen
START:
- Calculate furthest distance between max and min x and y values
- Must also center w/ an offset..
- use offset of minx + (maxx-minx)/2
and miny + (maxy-miny)/2
- the logic?
-the minimum x or y value should be at or near the minimum point
of the screen.
- test:
- if minx = 0 and maxx = 500, then
offset = 0 + 500/2 = 250. // SHOULD BE 0.
- iterate:
- so maybe xoff = minx + (maxx-minx)/2 - MAXX/2;
- test:
minx=-500, maxx=0;
xoff = -500 + (500)/2 - 250 = -500; NO. minx+xoff should = 0;
-Simplify:
-screen should center on the point (maxx-minx)/2, (maxy-miny)/2.
-Study:
given a point (x, y), how to center there?
-offset the point being drawn by the difference between that point and
the center point?
given a range of occupied space, how to zoom to fit screen?
- multiply all positions by a factor.. no, that is
dependent on the quadrant.
Taking out current follower code.
-increased part mass, sped up timestep GOAL: stabalize
- reduced forcePower to .5
- reduced forceFactor too. more stable, clumpy now
*/