4 Replies Latest reply on Dec 14, 2012 7:54 PM by Rothrock

    Anybody good at trig identities?

    Rothrock Level 5

      var d:Number = // a distance

      var h:Number = // a height (I know it should be hypotenuse, but it isn't really)

      var n:Number = // a number running from 0 to 1 in various small increments

       

      var newX:Number = -h + d*Math.tan(Math.atan(h/d) + 2*n*Math.asin(1/(2*Math.sqrt(d*d + h*h))

       

      I know I can make it look cleaner by breaking it out into some other variables. And it works just fine. I'm not trying to optimize it for speed or anything. It was way messier yesterday and I did figure out some stuff to make it nicer,  but I'm just wondering if there is some trig identity genius out there who sees an even tidier way of formatting this.

       

       

      In case you're wondering…I'm working on how to do anamorphic projections and this is the formula for projecting the x part.