/// <summary> /// Create a scale transform that scales around a given scale center (pivot point) /// </summary> /// <param name="pivot">pivot point</param> /// <param name="scaleX">The scale factor in x-direction.</param> /// <param name="scaleY">The scale factor in y-direction.</param> /// <returns>A <see cref="Transformation2D"/> that scales around a given pivot point.</returns> public static Transformation2D CreateScaleAround(Vector2 pivot, float scaleX, float scaleY) { var t = new Transformation2D(); t.TranslateGlobal(-pivot); t.ScaleGlobal(scaleX, scaleY); t.TranslateGlobal(pivot); return(t); }
/// <summary> /// Creates a rotation transform that rotates around a given rotation center (pivot point) /// </summary> /// <param name="pivot">pivot point</param> /// <param name="degrees">rotation in degrees</param> /// <returns>A <see cref="Transformation2D"/> that rotates around a given pivot point.</returns> public static Transformation2D CreateRotationAround(Vector2 pivot, float degrees) { var t = new Transformation2D(); t.TranslateGlobal(-pivot); t.RotateGlobal(degrees); t.TranslateGlobal(pivot); return(t); }