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 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)); }
[Test] public void DistanceToLineSquared() { Assert.AreEqual(1, Vector2D.UnitX.DistanceToLineSquared(Vector2D.Zero, Vector2D.Zero)); Assert.AreEqual(0, Vector2D.Zero.DistanceToLineSquared(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(0, Vector2D.UnitX.DistanceToLineSquared(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(0, (-Vector2D.UnitX).DistanceToLineSquared(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(1, Vector2D.UnitY.DistanceToLineSquared(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(25, (Vector2D.One * 5).DistanceToLineSquared(Vector2D.Zero, Vector2D.UnitX)); }
[Test] public void DistanceToLineSegment() { Assert.AreEqual(1, Vector2D.UnitX.DistanceToLineSegment(Vector2D.Zero, Vector2D.Zero)); Assert.AreEqual(0, Vector2D.Zero.DistanceToLineSegment(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(1, Vector2D.UnitY.DistanceToLineSegment(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(5, new Vector2D(6, 0).DistanceToLineSegment(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(5, new Vector2D(-3, -4).DistanceToLineSegment(Vector2D.Zero, Vector2D.UnitX)); Assert.AreEqual(0, Vector2D.Half.DistanceToLineSegment(Vector2D.UnitX, Vector2D.UnitY)); }
See Also