Example #1
0
        public static Transformation2D CreateScaleAround(float pivotX, float pivotY, float scaleX, float scaleY)
        {
            var t = new Transformation2D();

            t.TranslateGlobal(-pivotX, -pivotY);
            t.ScaleGlobal(scaleX, scaleY);
            t.TranslateGlobal(pivotX, pivotY);
            return(t);
        }
Example #2
0
        /// <summary>
        /// create a rotation matrix that rotates around a given rotation center (pivot point)
        /// </summary>
        /// <param name="pivotX">rotation center x</param>
        /// <param name="pivotY">rotation center y</param>
        /// <param name="angle">radiant</param>
        /// <returns></returns>
        public static Transformation2D CreateRotationAround(float pivotX, float pivotY, float degrees)
        {
            var t = new Transformation2D();

            t.TranslateGlobal(-pivotX, -pivotY);
            t.RotateGlobal(degrees);
            t.TranslateGlobal(pivotX, pivotY);
            return(t);
        }