Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Power Blender
Flip Sprite - Make a sprite appear to rotate in 3-D space.
ToolTip Behavior
Jeff's Platform Game Engine v2
Pan QTVR Sprite
RADEMAIL
Puzzler II, Slide it!
TAGGuard
Irregular Slider
Slide show
 

 

 

Behavior Vector Shape - Create Ellipse (Improved)

Added on 9/30/2006

 

Compatibilities:
behavior D8 D8_5 D9 Mac PC Shockwave

This item has not yet been rated

Author: Chunick (website)

This is a more accurate algorithm which will draw an ellipse or circle more accurately. In fact, it's impossible to draw a perfect circle using bezier curves, but we can approximate it very closely using kappa (k). For those interested, info can be found here: http://www.whizkidtech.redprince.net/bezier/circle/

on createEllipse (aWidth, aHeight)
  
  rX = aWidth / 2.0
  if voidP(aHeight) then aHeight = aWidth
  rY = aHeight / 2.0
  pt1 = point(rX*cos(3.92699081698724), rY*sin(3.92699081698724))
  pt2 = point(rX*cos(5.49778714378214), rY*sin(5.49778714378214))
  pt3 = point(rX*cos(0.78539816339745), rY*sin(0.78539816339745))
  pt4 = point(rX*cos(2.35619449019234), rY*sin(2.35619449019234))
  
  k = 0.552284749830794
  
  vertList = [[#vertex: pt1, #handle1: pt1 * point(-k, k), #handle2: pt1 * point(k, -k)], [#vertex: pt2, #handle1: pt2 * point(k, -k), #handle2: pt2 * point(-k, k)], [#vertex: pt3, #handle1: pt3 * point(-k, k), #handle2: pt3 * point(k, -k)], [#vertex: pt4, #handle1: pt4 * point(k, -k), #handle2: pt4 * point(-k, k)]]
  
  return vertList
  
end  

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail