/// <summary> /// Transforms the center of a rectangle /// </summary> /// <param name="rectangle">The rectangle to transform.</param> /// <param name="transformation">Transformation to apply.</param> public static void TransformCenter(this Box2D rectangle, Transformation transformation) { var newCenter = transformation.Transform(rectangle.GetCenter()); rectangle.CenterX = newCenter.X; rectangle.CenterY = newCenter.Y; }
/// <summary> /// Transforms the center of a rectangle by a matrix /// </summary> /// <param name="rectangle">to transform</param> /// <param name="M">transformation matrix to apply</param> public static void TransformCenter(this Box2D rectangle, Matrix3x2 M) { var newCenter = Vector2.Transform(rectangle.GetCenter(), M); rectangle.CenterX = newCenter.X; rectangle.CenterY = newCenter.Y; }