In Fundamentals

I could not get this pixel math equation to work that was used in the video "Masks Section 4":

*sin(PA) - (y()-offsety) *cos(PA))/b)^2 ); iif(r<max_r, ~(r/max_r), 0)
offsetx=2000, offsety=2000, max_r=1, a=500, b=200, angle=60, PA, r

Must be  something stupid.  What am I missing here?

*** Error: Mismatched right parenthesis:
*sin(PA) - (y()-offsety) *cos(PA))/b)^2 ); iif(r<max_r, ~(r/max_r), 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
<* failed *>

Comments

  • Hi Gary,

    I do not think that is the complete expression. 
    Keep in mind, this formula become the basis of the GAME script. (Which means, you can use the GAME script instead of my cool "manual" formula.)

    See:

    Specifically:

    PA=pi()*angle/180;

    r = sqrt( (((x()-offsetx)*cos(PA) + (y()-offsety)*sin(PA))/a)^2 + (((x()-offsetx)*sin(PA) - (y()-offsety)*cos(PA))/b)^2 );

    iif(r<max_r, ~(r/max_r), 0)

    With symbols:

    offsetx=1000,

    offsety=1000,

    max_r=1,

    a=200,

    b=100,

    angle=90,

    PA,

    r




  • Thanks Adam! Got it.
Sign In or Register to comment.