Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

senocular.com ActionScript Library

CAKE.as

Name: Math.CAKE - the best thing since PI
Author: senocular: www.senocular.com
Date: 1899-12-31T00:07:16.100
Documentation:
Back in the good old days, everyone made PIs.  There was nothing better than a good
old fasioned home made PI.  Everyone made them.  Life was good.  However, sometimes
you need a change.  Thats where bakers came in.  They presented people with a new
array of delicious goods, mainly the PI's counterpart, the CAKE. Similar to PIs CAKES
were round in shape.  However, because CAKES were sold and distributed, they needed
to be boxed, where as PIs, being made and eaten at home, simply existed in a round
dish (hense the PIs association with circles).  Thus there existed a need for calculating
box sizes and "circumference".  Here is where Math.CAKE comes into play.  Given any square
diagonal (d), when multiplied by Math.CAKE will result in the squares "circumference" or
rather the total length of its perimeter.
 
P = d*CAKE;
 
;)

Example:
perimeter = diagonal*Math.CAKE;

1
Math.CAKE = Math.SQRT2*2;