Friday, November 11, 2005

limiting random origin motion


double RandOrgRange = 1; // 0 to 2, default is 1
DPOINT RandOrgBias = {0, 0}; // -.5 to .5, default is 0
double ofs = (1 - RandOrgRange) / 2;
m_TargetOrg.x = double(rand()) / RAND_MAX
* RandOrgRange + ofs + RandOrgBias.x;
m_TargetOrg.y = double(rand()) / RAND_MAX
* RandOrgRange + ofs + RandOrgBias.y;

Wednesday, November 09, 2005

seed of life

It's dependent on the frame rate. Frame rate, birth rate, ring spacing, and skew angle delta interact to determine how many ring tunnels are generated.

If birth rate = 1, ring spacing = 5, and skew angle freq = 1, at 25 FPS you get 5 ring tunnels (a 5-way seed of life), because you're generating 5 rings per second, and each ring has a fifth of the skew angle delta (.2 Hz = 72 degrees), and 5 clock ticks.

at 30 FPS, with the same settings, you get a 6-way seed of life.

Color speed can also be adjusted to achieve a constant color for each tunnel. 14.4 (a fifth of 72) works for the 5-way at skew angle = 1; 90 works for most of the others.

Since the rings continue to intersect at the origin no matter how big they get, the rings will never be entirely off-canvas, and thus will never be deleted. This is a dangerous side effect and yet another argument for a max rings parameter.

Useful formulas:
Birth Ring Skew ring color
FPS Rate Space Ang Hz tunnels speed
25 .25 5 1.25 1 90
25 .5 5 1.25 2 90
25 .75 5 1.25 3 90
25 1 5 1.25 4 90
25 1.25 5 1.25 5 72
25 1.5 5 1.25 6 90
25 1.75 5 1.25 7 90*
25 2 5 1.25 8 90*
25 2.25 5 1.25 9 90*
25 2.5 5 1.25 10 72*

*colors are stable but tunnels don't appear in spectral order