Vector2D Normalize Method Delta Engine Documentation

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

public static Vector2D Normalize(
	Vector2D vector
)

Return Value

Type: Vector2D
Remarks

Tests: DeltaEngine.Tests.Datatypes.Vector2DTests
Examples

2 unit tests call DeltaEngine.Datatypes.Vector2D.Normalize(DeltaEngine.Datatypes.Vector2D)
[Test]
public void Normalize()
{
    var v = Vector2D.Normalize(new Vector2D(0.3f, -0.4f));
    Assert.AreEqual(new Vector2D(0.6f, -0.8f), v);
}
[Test]
public void DotProduct()
{
    var v3 = Vector2D.Normalize(new Vector2D(1, 1));
    var v4 = Vector2D.Normalize(new Vector2D(-1, 1));
    Assert.AreEqual(0.0f, v3.DotProduct(v4));
    Assert.AreEqual(0.7071f, v3.DotProduct(Vector2D.UnitY), 0.0001f);
}
See Also