WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Visualizations > AVS > hey guys!
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
Kookee
Major Dude

Registered: Jun 2001
From:

hey guys!

long time no postie! XD

hey I just wanted to try out something that I'm learning in school (heh, collage!)

obviously in AVS we're limited to a -1 <-> 1 in both x & y fields, but I want to try and make lines that would normally be graphed greater than 1 and get the same result.

I've tweaked out the math (like decreasing x & y by a multiple) with no result.

so, at least my example that I would like to work with is a line using f(x) = x / ( x^2 - x - 2)

which solving for x, you swap "f(x)" as "y", and use "x" (in our case) should be the "i" (drawing the line)

the result should split the line twice with two vertical asymptotes with those being at x= -1 & 2

can anyone translate this into an avs field (between -1 <-> 1)?

Quick Link | Report this post to a moderator | IP: Logged

Kookee is offline Old Post 10-14-2009 12:51 AM
Click Here to See the Profile for Kookee Click here to Send Kookee a Private Message Click Here to Email Kookee Find more posts by Kookee Add Kookee to your buddy list Edit/Delete Message Reply w/Quote
QOAL
[I am a retard]

Registered: Apr 2002
From: Bristol, UK

Should just be a simple case of scaling i as needed.

Try something like:
Init
n = w;

Frame //This is just code for aspect ratio correct
asph = if(above(w, h), h / w, 1);
aspv = if(above(h, w), w / h, 1);

Point
k = (i * 10) - 5;
x = (k / 5) * asph;
y = (k / (pow(k, 2) - k - 2)) / aspv;



That should do roughly what you're looking for.

__________________
count!last.fmdapin board Dark forum themeAstrosmash

Quick Link | Report this post to a moderator | IP: Logged

QOAL is offline Old Post 10-14-2009 06:21 PM
Click Here to See the Profile for QOAL Click here to Send QOAL a Private Message Find more posts by QOAL Add QOAL to your buddy list Edit/Delete Message Reply w/Quote
Kookee
Major Dude

Registered: Jun 2001
From:

Aw! thanks!

man, you have no idea how nice that looks.

so basically if i wanted to edit all of that for different lines, i could only need to replace the code, but keep the 'k' where it is, and substitute (in x & y) for 'k'?

or just keep the function for k and x, but only change the 'y', and instead of said 'x' use 'k'? (then of course divide 'y' by 'k'

Quick Link | Report this post to a moderator | IP: Logged

Kookee is offline Old Post 10-15-2009 12:52 AM
Click Here to See the Profile for Kookee Click here to Send Kookee a Private Message Click Here to Email Kookee Find more posts by Kookee Add Kookee to your buddy list Edit/Delete Message Reply w/Quote
QOAL
[I am a retard]

Registered: Apr 2002
From: Bristol, UK

K is the position along the line, and X is the scaled position along the line. (So it fits between -1 and 1)
So as long as you're just effecting Y you only need to edit the Y code, with K replacing X.
To change what it's calculated between just change the equation for K and tweak what K is divided by for X, so it's zoomed correctly.

Does that make sense?

This does not scale the height of Y though. And the Y axis is the wrong way around I think too.
To be honest it's not too complex to figure out anyway, it's not really anything AVS specific and where it is you can just turn to the Expression Help.


Oh whoops the '/ aspv' should be '* aspv' btw. (I should actually test stuff before just writing stuff)

(Someone shout at me if I'm wrong!)

__________________
count!last.fmdapin board Dark forum themeAstrosmash

Quick Link | Report this post to a moderator | IP: Logged

QOAL is offline Old Post 10-15-2009 10:46 AM
Click Here to See the Profile for QOAL Click here to Send QOAL a Private Message Find more posts by QOAL Add QOAL to your buddy list Edit/Delete Message Reply w/Quote
Warrior of the Light
Forum King

Registered: Aug 2002
From: Holland

You're correct (tested it).
if framerate were important, I would use sqr(k) instead of pow(k,2).

__________________

Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever

Quick Link | Report this post to a moderator | IP: Logged

Warrior of the Light is offline Old Post 10-15-2009 01:41 PM
Click Here to See the Profile for Warrior of the Light Click here to Send Warrior of the Light a Private Message Click Here to Email Warrior of the Light Visit Warrior of the Light's homepage! Find more posts by Warrior of the Light Add Warrior of the Light to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 04:39 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Visualizations > AVS > hey guys!
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON