Namespace: DeltaEngine.Tests.Datatypes
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Examples
[Test] public void DistanceTo() { var zero = new Vector2D(); var v = new Vector2D(3, 4); Assert.AreEqual(5, zero.DistanceTo(v)); Assert.AreEqual(0, zero.DistanceTo(zero)); }
[Test] public void DistanceToSquared() { var zero = new Vector2D(); var v = new Vector2D(3, 4); Assert.AreEqual(25, zero.DistanceToSquared(v)); Assert.AreEqual(0, zero.DistanceToSquared(zero)); }
[Test] public void DistanceToLine() { Assert.AreEqual(1, Vector2D.UnitX.DistanceToLine(Vector2D.Zero, Vector2D.Zero)); Assert.AreEqual(0, Vector2D.Zero.DistanceToLine(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(0, Vector2D.UnitX.DistanceToLine(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(0, (-Vector2D.UnitX).DistanceToLine(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(1, Vector2D.UnitY.DistanceToLine(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(5, (Vector2D.One * 5).DistanceToLine(Vector2D.Zero, Vector2D.UnitX)); }
See Also