Quantcast
Channel: Adobe Community : All Content - All Communities
Viewing all articles
Browse latest Browse all 290743

Anybody good at trig identities?

$
0
0

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.


Viewing all articles
Browse latest Browse all 290743

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>