public void DistanceBetweenTest() { var pointOne = new LucidPoint(0, 0); var pointTwo = new LucidPoint(5, 0); Assert.AreEqual(5, GeometryHelper.DistanceBetween(pointOne, pointTwo)); }
public void GetAngleInRadiansTest() { var refPoint = new LucidPoint(0, 0); Assert.AreEqual(0, GeometryHelper.Angle(refPoint, new LucidPoint(1, 0))); Assert.AreEqual(Math.PI, GeometryHelper.Angle(refPoint, new LucidPoint(-1, 0))); }
public void CoincidentTest() { var first = new LucidPoint() { X = 2.4, Y = 3 }; var second = new LucidVertex() { X = 2.4, Y = 3 }; Assert.IsTrue(GeometryHelper.Intersects(first, (IPoint)second)); foreach (var change in new Action[] { () => second.Y = 4, () => { first.Y = 4; first.X = 2; }, () => second.Y = 2.232 }) { change(); Assert.IsFalse(GeometryHelper.Intersects(first, (IPoint)second)); } }
public void SplitLengthTest() { var line = (ILucidLine)GeometryHelper.Create(File.ReadAllText("../../Data/lineToSplit.json")); var referencePoint = new LucidPoint(-9165777.5026, 3457646.8105999976); var cutter = GeometryHelper.CircularPathFromPoint(referencePoint, .5, 20); var parts = GeometryHelper.Split(line, cutter).ToArray(); Assert.AreEqual(GeometryHelper.Length(line), GeometryHelper.Length(parts[0]) + GeometryHelper.Length(parts[1])); }
public void LengthTest() { var length = GeometryHelper.Length(LucidLine.Create(new IPoint[] { LucidPoint.Create(0, 0), LucidPoint.Create(1, 0), LucidPoint.Create(1, 2), })); Assert.AreEqual(3, length); length = GeometryHelper.Length(LucidLine.Create(new IPoint[] { LucidPoint.Create(0, 0), LucidPoint.Create(0, 5) })); Assert.AreEqual(5, length); }