Notes:
A TNTPolygon requires the basics: a center (TNTPoint), an integer number of sides (numSides), a real-valued radius (r > 0), and ubiquitous fill color (TNTColor, fcolr), stroke (TNTStroke) and a real-valued rotation (rotn, in degrees). Note all sides are the same, so your ever-loving math teacher would call it a 'regular' polygon. Just say'n.
As shown in the picture above, an optional boolean property (showPoints) allows you to choose whether or not to show the vertices (corners) of the image.
Yes, we did use sine and cosine to get those points. Study your trig and Geometry, kiddies! Need to 'solve' a regular polygon? Check out our trusty Polygon Solver. It's really old and needs an upgrade, but it works!
Technically, these polygons are 'regular' because all their sides are equal. We have our TNTGenPolygon which lets you build a polygon of your choice by providing it an array of vertices.
TNTPolygon Features and Usage:
| Primary Attributes: |
6 Parameters: |
|---|---|
| To Create: |
The 'stop sign' example above was created by:
var myStopSign = new TNTPolygon(ptA, 8, 15, red, maroonStroke, 22.5);
myStopSign.accentColor = yellow;
myStopSign.showCenter = true;
myStopSign.showPoints = true;
myStopSign.drawTNTPolygon(context);
|
| To Draw: |
myStopSign.drawTNTPolygon(context); |
| Comments: |
A fillColor of 'null' would prevent the shape from being filled with color |
| Even More: |
