hyades.physics.Shape.Transform C# (CSharp) Method

Transform() public static method

public static Transform ( Vector2 &points, Vector2 &position, float angle, Vector2 &scale, Vector2 &list ) : void
points Vector2
position Vector2
angle float
scale Vector2
list Vector2
return void
        public static void Transform(ref Vector2[] points, ref Vector2 position, float angle, ref Vector2 scale, out Vector2[] list)
        {
            int count = points.Length;
            Vector2[] array = new Vector2[count];

            for (int i = 0; i < count; i++)
            {
                // rotate the point, and then translate.
                float x = points[i].X * scale.X;
                float y = points[i].Y * scale.Y;
                float c = (float)Math.Cos(angle);
                float s = (float)Math.Sin(angle);
                array[i].X = (c * x) - (s * y) + position.X;
                array[i].Y = (c * y) + (s * x) + position.Y;
            }

            list = array;
        }