MatrixTests CreateScale Method Delta Engine Documentation

Namespace: DeltaEngine.Tests.Datatypes
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void CreateScale()
Examples

[Test]
public void CreateScale()
{
    matrix = Matrix.CreateScale(Vector3D.One*2);
    var expected = new Matrix(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1);
    Assert.AreEqual(expected, matrix);
}
[Test]
public void CreateScaleFromThreeScalar()
{
    matrix = Matrix.CreateScale(3, 4, 7);
    var expected = new Matrix(3, 0, 0, 0, 0, 4, 0, 0, 0, 0, 7, 0, 0, 0, 0, 1);
    Assert.AreEqual(expected, matrix);
}
[Test]
public void TransformPosition()
{
    var position = new Vector3D(3, 5, 2);
    var translation = Matrix.CreateTranslation(2, 0, 5);
    var rotation = Matrix.CreateRotationZYX(0, 90, 0);
    var scale = Matrix.CreateScale(3, 3, 3);
    var transformation = scale * rotation * translation;
    var result = translation * (rotation * (scale * position));
    Assert.IsTrue((transformation * position).IsNearlyEqual(result));
}
See Also