Archive: Randomising start/end ssc loc's


2nd July 2005 08:04 UTC

Randomising start/end ssc loc's
Ok, specifically -

Trying to do:
Have a vertical oscSSC start randomly along x though fixed at y-1 and ending randomly anywhere in the screen, preferably in any given area.

Then split a second oscSSC off a random point in the first SSC to another random end locale.

As can be guessed, lightning! Boring most will say, Learning sez I. With a lot of nutting, I was able to randomise the positioning of the whole scope while starting it at y-1, but the whole first scope still runs verticall which most lightning doesn't. ;)

I'm not after someone to make the nuts n bolts - that achieves me sweet f/a. What I am after is a bit of help in understanding how to utilise a specific point in (i).

I understand x=getosc(i,1,0)etc. and that i/3 is the point 33% of the way up the ssc. but how can I implement it into the positioning co-ords to achieve what I am after.

I've pulled apart a huge amount of ssc's but havn't found many yet that randomise the start/end and even less that I can understand as it's buried in 30 lines of tan/sin/greek/russian. ;)

Have almost every avs doc made on my hd but not really helping - I'm obvious;y missing something.

Cheers for any help.

nNem


2nd July 2005 13:50 UTC

Hooray!

Just worked out gmegabuf() so I can now splice the value of any i pos into second SSC for a starting locale.

Tho still don't understand how to change the start and end locale of an SSC independantly of each other.

Back to all the tute's. If anyone can clear it up so I can really understand it, would be real nice. :)

Cheers

nNem


2nd July 2005 22:26 UTC

Well my idea was to derive a transformation matrix to fit a vertical line to two random points, and apply that to vertical osc. But ASD5A pointed out that it can be done easier with some simple vector work (in other words simplify a transfomation matrix)

The basic idea is given a point (x1,y1) and another point (x2,y2), a vector between those points may be defined as:

vx=x2-x1;
vy=y2-y1;

Then we can render that line with:

x=x1+i*vx;
y=y1+i*vy;

and add osc values with:

x=x1+i*vx+v*0.2*vy;
y=y1+i*vy-v*0.2*vx;

Then we can add a counter that increments each point, and store the x and y values when it reaches a certain value. We can use these stored values as the start point of another osc. See the attached preset (it is essentially ASD5A's solution not mine)


3rd July 2005 06:24 UTC

Ahhh, ty very much. This was initially the sort of thing that I imagined it to be, but then got caught into a getosc() trap. ;)

Being a simplified way, I can now probably adapt it to a getosc() as I beleive faster framerate? (correct me if wrong). And at least I can use blah=reg01 now rather than gmegabuf().

Thank you again and no wonder I couldn't find an answer, I didn't know what to correctly look for! ^^

nNem


3rd July 2005 06:50 UTC

getosc gives you a little more control but it isnt any faster (at a push I'd say its infinitesimally slower because of the function call overhead)

If you want to modify the preset for learning purposes I suggest you try finding a way of removing the use of 'i' from the superscopes, using your own point counters is one of the most significant things to learn with superscope usage imo.


3rd July 2005 10:22 UTC

I've seen threads and comments about removing 'i' from scopes as being an integral part of being able to program SSC's, so when I have it looking the way I want, I'll give it go. :)

Cheers

nNem