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
Angle detection by J.R.D.R.
Scroll Thumb
Vector Shapes - Create Donut
Direct Media Video Slider
Light Up Game Controller
Installed ActiveX
Triming spaces from string
Direct Media Volume Slider
Tempo Lingo
Lingo MarkUp Service
 

 

 

Behavior Vector Shape - Create Polygon

Added on 2/7/2006

 

Compatibilities:
D8 D8_5 D9 Mac PC

This item has not yet been rated

Author: Chunick (website)

Pass the width, height and number of sides to create polygon shapes such as stop signs, pentagons, etc.

  
  vertList = []
  
  sides = integer(sides)
  
  a = max(width, height) / 2.0
  b = min(width, height) / 2.0
  
  rad = (360 / float(sides)) * (pi / 180)
  radOffset = rad + (90 * (pi / 180))
  
  repeat with i = 1 to sides
    t = (i * rad) - radOffset
    x = a * cos(t)
    y = b * sin(t)
    vertList.add([#vertex: point(x, y)])
  end repeat
  
  return vertList
  
end

 


Contact

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

Send e-mail