fCraft.ShapesLib.CalculateVertices C# (CSharp) Method

CalculateVertices() private method

private CalculateVertices ( int sides, int radius, int startingAngle, Point center ) : Point[]
sides int
radius int
startingAngle int
center Point
return Point[]
        private Point[] CalculateVertices( int sides, int radius, int startingAngle, Point center )
        {
            if ( sides < 3 )
                throw new ArgumentException( "Polygon must have 3 sides or more." );

            List<Point> points = new List<Point>();
            float step = 360.0f / sides;

            float angle = startingAngle;
            for ( double i = startingAngle; i < startingAngle + 360.0; i += step ) {
                points.Add( DegreesToXY( angle, radius, center ) );
                angle += step;
            }

            return points.ToArray();
        }