Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void TestGetTrace()
        {
            var pq0 = new Piquet {
                Name = "0", Step = 0, X = 0, Y = 0, Z = 0
            };
            var res = new List <Piquet> {
                pq0
            };

            TopoLib.GetTrace(_trcLst, res, pq0);
            var deltaX = 0D;
            var deltaY = 0D;

            foreach (var piquet in res)
            {
                var pq = piquet;
                foreach (var piquet1 in _piqLst.Where(p => p.Name == pq.Name))
                {
                    deltaX += Math.Abs(pq.X - piquet1.X);
                    deltaY += Math.Abs(pq.Y - piquet1.Y);
                }
            }

            //var a = Math.Sqrt(deltaX*deltaX + deltaY*deltaY)/_trcLst.Sum(tr => tr.Tape);//==0.0196 (1.96 %)
            var bResult = res.Count == 19 && Math.Sqrt(deltaX * deltaX + deltaY * deltaY) / _trcLst.Sum(tr => tr.Tape) < 0.04;

            Assert.AreEqual(bResult, true);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public void TestGetString()
        {
            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 pqTemp = new List <Piquet> {
                pqList[0]
            };
            var res    = TopoLib.GetString(pqTemp, _trcLst, pqList[0], pqList);
            var result = res.Count <= _trcLst.Count && pqTemp.Count == pqList.Count;

            Assert.AreEqual(result, true);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }