static void Render() { view.Render(); batch.Begin(); batch.SetMatrix(Matrix3x2.Scale(Screen.PixelSize, Screen.PixelSize)); batch.DrawTextureFlipped(view.Texture, Vector2.Zero, Color4.White); batch.End(); }
public static void AbstractScalingMatricesCanInverse() { var x = Var("𝓍"); var y = Var("𝓎"); var m = Matrix3x2.Scale(x, y); var im = m.Invert(); // NB: Expressions such as x / y cannot simplify when y is a variable. // Because of this, we can't verify M*M⁻¹ and M⁻¹*M… Assert.NotEqual(Matrix3x2.Identity, m); Assert.NotEqual(Matrix3x2.Identity, im); }
private void SetDisplayTransform(Matrix3x2 displayTransform) { Matrix3x2 pointTransform = _transform * displayTransform; Vector2 scale = pointTransform.Scale(); double length = scale.LengthSquared(); // PointTransform will throw if we provide a very small scale. if (length < 10E-7) { scale = Vector2.One / scale; pointTransform *= Matrix3x2.CreateScale(scale); } Stroke.PointTransform = pointTransform; }
public static void ConcreteScalingMatricesCanInverse(int sx, int sy) { var m = Matrix3x2.Scale(sx, sy); var im = m.Invert(); Assert.NotEqual(Matrix3x2.Identity, m); Assert.NotEqual(Matrix3x2.Identity, im); var a = m * im; var b = im * m; Assert.Equal(a, b); Assert.Equal(Matrix3x2.Identity, a); Assert.Equal(Matrix3x2.Identity, b); }