예제 #1
0
파일: Polygon.cs 프로젝트: cjsatuforc/eakit
        public static Polygon BuildRectangle(float x, float y, float width, float height)
        {
            Polygon result = new Polygon(4);

            result.AddVertex(x, y);
            result.AddVertex(x + width, y);
            result.AddVertex(x + width, y + height);
            result.AddVertex(x, y + height);
            return(result);
        }
예제 #2
0
파일: Polygon.cs 프로젝트: cjsatuforc/eakit
        public static Polygon BuildCircle(int vertices, Vector2 center, float radius)
        {
            Polygon result = new Polygon(vertices);

            for (double i = 0; i < MathHelper.TwoPi; i += (float)MathHelper.TwoPi / (float)vertices)
            {
                result.AddVertex(center + radius * new Vector2((float)(Math.Cos(i)), (float)(Math.Sin(i))));
            }
            return(result);
        }