Nez.Portable/Physics/Shapes/Polygon.cs
/// <summary>
/// builds a symmetrical polygon (hexagon, octogon, n-gon) and returns the points
/// </summary>
/// <returns>The symmetrical polygon.</returns>
/// <param name="vertCount">Vert count.</param>
/// <param name="radius">Radius.</param>
builds a symmetrical polygon (hexagon, octogon, n-gon) and returns the points
builds a symmetrical polygon ( hexagon octogon n - gon ) and returns the points
public static Vector2[] buildSymmetricalPolygon(int vertCount, float radius)
        {
            var verts = new Vector2[vertCount];
            for (var i = 0; i < vertCount; i++)
            {
                var a = 2.0f * MathHelper.Pi * (i / (float)vertCount);
                verts[i] = new Vector2(Mathf.cos(a), Mathf.sin(a)) * radius;
            }
            return verts;
        }
public static Vector2 [ ] buildSymmetricalPolygon ( int vertCount , float radius ) { var verts = new Vector2 [ vertCount ] ; for ( var i = 0 ; i < vertCount ; i ++ ) { var a = 2.0f * MathHelper . Pi * ( i / ( float ) vertCount ) ; verts [ i ] = new Vector2 ( Mathf . cos ( a ) , Mathf . sin ( a ) ) * radius ; } return verts ; }
builds a symmetrical polygon (hexagon, octogon, n-gon) and returns the points
builds a symmetrical polygon ( hexagon octogon n - gon ) and returns the points
The symmetrical polygon.
The symmetrical polygon .
vertCount
int
None
radius
float
None