Exemplo n.º 1
0
        internal bool FindPosition(Scaner result)
        {
            List <Distance> distance = IntersectDistance(result);

            if (distance.Count >= 66)
            {
                for (var x = 0; x < 4; ++x)
                {
                    if (RotateAndMove(result, distance[0].point3D1))
                    {
                        return(true);
                    }
                    Rotate(0);
                }
                Rotate(1);
                if (RotateAndMove(result, distance[0].point3D1))
                {
                    return(true);
                }
                Rotate(1);
                Rotate(1);
                if (RotateAndMove(result, distance[0].point3D1))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        private bool Intersect(Scaner result)
        {
            var hashes      = GetBeaconsHash();
            var otherHashes = result.GetBeaconsHash();

            hashes.IntersectWith(otherHashes);
            return(hashes.Count >= 6);
        }
Exemplo n.º 3
0
        internal void CopyBeacons(Scaner scaner)
        {
            var hashes = GetBeaconsHash();

            for (var i = 0; i < scaner.Beacons.Count; ++i)
            {
                if (!hashes.Contains(scaner.Beacons[i]))
                {
                    Beacons.Add(scaner.Beacons[i]);
                }
            }
        }
Exemplo n.º 4
0
 bool RotateAndMove(Scaner result, Point3D basePoint)
 {
     for (var z = 0; z < 4; ++z)
     {
         for (var i = 0; i < result.Beacons.Count; ++i)
         {
             Move(basePoint - result.Beacons[i]);
             if (Intersect(result))
             {
                 return(true);
             }
         }
         Rotate(2);
     }
     return(false);
 }
Exemplo n.º 5
0
 public Scaner(Scaner scaner)
 {
     IsAdded = scaner.IsAdded;
     Number  = scaner.Number;
     Beacons = new List <Point3D>(scaner.Beacons);
 }
Exemplo n.º 6
0
 private List <Distance> IntersectDistance(Scaner result)
 {
     return(result.GetDistances().Intersect(GetDistances()).ToList());
 }