public void TestGetRings() { var pq0 = new Piquet { Name = "0", Step = 0, X = 0, Y = 0, Z = 0 }; var pqList = new List <Piquet> { pq0 }; TopoLib.GetTrace(_trcLst, pqList, pq0); var rings = TopoLib.GetAllRing(_trcLst, pqList, pq0); var result = true; if (rings.Count > 0) { foreach (var ring in rings) { var start = ring.Points.First(); var end = ring.Points.Last(); result = result && (_trcLst.Exists( trc => trc.From == start.Name && trc.To == end.Name || trc.From == end.Name && trc.To == start.Name)); } } Assert.AreEqual(result, true); }
public void TestPiquetsCorrection() { var pq0 = new Piquet { Name = "0", Step = 0, X = 0, Y = 0, Z = 0 }; var pqList = new List <Piquet> { pq0 }; TopoLib.GetTrace(_trcLst, pqList, pq0); var sumBefore = 0D; foreach (var piquet in pqList) { sumBefore += _piqLst.Where(p => p.Name == piquet.Name) .Sum(piquet1 => (Math.Abs(piquet.X - piquet1.X) + Math.Abs(piquet.Y - piquet1.Y) + Math.Abs(piquet.Z - piquet1.Z))); } var rings = TopoLib.GetAllRing(_trcLst, pqList, pq0); foreach (var ring in rings) { foreach (var point in ring.Points) { var piquet = pqList.Find(p => p.Name == point.Name); piquet.Correct(point.Offset); TopoLib.PiquetsCorrection(ring, _trcLst, pqList, piquet, point.Offset); } } var sumAfter = 0D; foreach (var piquet in pqList) { sumAfter += _piqLst.Where(p => p.Name == piquet.Name) .Sum(piquet1 => (Math.Abs(piquet.X - piquet1.X) + Math.Abs(piquet.Y - piquet1.Y) + Math.Abs(piquet.Z - piquet1.Z))); } var result = Math.Abs(sumBefore - sumAfter) > MathConst.Accuracy; Assert.AreEqual(result, true); }
public void TestGetRingLength() { var pq0 = new Piquet { Name = "0", Step = 0, X = 0, Y = 0, Z = 0 }; var pqList = new List <Piquet> { pq0 }; TopoLib.GetTrace(_trcLst, pqList, pq0); var rings = TopoLib.GetAllRing(_trcLst, pqList, pq0); var lengths = new List <double>(); if (rings.Count > 0) { lengths.AddRange(rings.Select(ring => TopoLib.GetRingLength(ring, _trcLst))); } Assert.AreEqual(lengths[0], 15.1); }
public void TestGetRingOffset() { var pq0 = new Piquet { Name = "0", Step = 0, X = 0, Y = 0, Z = 0 }; var pqList = new List <Piquet> { pq0 }; TopoLib.GetTrace(_trcLst, pqList, pq0); var rings = TopoLib.GetAllRing(_trcLst, pqList, pq0); var offsets = new List <Vector>(); if (rings.Count > 0) { offsets.AddRange(rings.Select(ring => TopoLib.GetRingOffset(ring, _trcLst, pqList))); } var result = offsets[0].Length - 0.0343 < 0.001 && offsets[0].Teta < MathConst.Accuracy && Math.Abs(offsets[0].Fi) - 73 < 0.1; Assert.AreEqual(result, true); }