Exemplo n.º 1
0
        static LinkedListDictionary <int, List <Edge <T> > > DivideIntoBoundaries(IEnumerable <Edge <T> > periodicEdges)
        {
            LinkedListDictionary <int, List <Edge <T> > > edges = new LinkedListDictionary <int, List <Edge <T> > >();
            LinkedList <Edge <T> > firstEdges = new LinkedList <Edge <T> >();

            int  firstBoundaryEdgeNumber = -1;
            bool isFirstBoundaryLine     = true;

            foreach (Edge <T> edge in periodicEdges)
            {
                if (isFirstBoundaryLine)
                {
                    isFirstBoundaryLine = IsStillFirstBoundary(edge.BoundaryEdgeNumber, ref firstBoundaryEdgeNumber);
                }
                if (isFirstBoundaryLine)
                {
                    firstEdges.AddLast(edge);
                }
                else
                {
                    Add(edges, edge);
                }
            }
            foreach (Edge <T> edge in firstEdges)
            {
                Add(edges, edge);
            }
            return(edges);
        }
Exemplo n.º 2
0
 public UnityARAnchorManager()
 {
     planeAnchorMap = new LinkedListDictionary <string, ARPlaneAnchorGameObject> ();
     UnityARSessionNativeInterface.ARAnchorAddedEvent   += AddAnchor;
     UnityARSessionNativeInterface.ARAnchorUpdatedEvent += UpdateAnchor;
     UnityARSessionNativeInterface.ARAnchorRemovedEvent += RemoveAnchor;
 }
Exemplo n.º 3
0
 protected GameListBase(AppLobby lobby)
 {
     this.Lobby = lobby;
     this.gameDict = new LinkedListDictionary<string, GameState>();
     this.changedGames = new Dictionary<string, GameState>();
     this.removedGames = new HashSet<string>();
 }
Exemplo n.º 4
0
 void Start()
 {
     probeAnchorMap = new LinkedListDictionary <string, ReflectionProbeGameObject> ();
     UnityARSessionNativeInterface.AREnvironmentProbeAnchorAddedEvent   += EnvironmentProbeAnchorAdded;
     UnityARSessionNativeInterface.AREnvironmentProbeAnchorRemovedEvent += EnvironmentProbeAnchorRemoved;
     UnityARSessionNativeInterface.AREnvironmentProbeAnchorUpdatedEvent += EnvironmentProbeAnchorUpdated;
 }
Exemplo n.º 5
0
 public GameList()
 {
     this.id = Guid.NewGuid();
     this.gameDict = new LinkedListDictionary<string, GameState>();
     this.changedGames = new Dictionary<string, GameState>();
     this.removedGames = new HashSet<string>();
 }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     objectAnchorMap = new LinkedListDictionary <string, GameObject> ();
     UnityARSessionNativeInterface.ARObjectAnchorAddedEvent   += ObjectAnchorAdded;
     UnityARSessionNativeInterface.ARObjectAnchorRemovedEvent += ObjectAnchorRemoved;
     UnityARSessionNativeInterface.ARObjectAnchorUpdatedEvent += ObjectAnchorUpdated;
 }
Exemplo n.º 7
0
 public UnityARAnchorManager(UnityARGeneratePlane plane, GameObject hitParent, UnityARHitTestExample sharp, UnityARCameraManager camera_manager)
 {
     planeAnchorMap = new LinkedListDictionary <string, ARPlaneAnchorGameObject> ();
     UnityARSessionNativeInterface.ARAnchorAddedEvent   += AddAnchor;
     UnityARSessionNativeInterface.ARAnchorUpdatedEvent += UpdateAnchor;
     UnityARSessionNativeInterface.ARAnchorRemovedEvent += RemoveAnchor;
     generatedPlane      = plane;
     hitScript           = sharp;
     Camera_managerScrpt = camera_manager;
 }
Exemplo n.º 8
0
        public SqlGameList(AppLobby lobby)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Creating new GameList");
            }

            this.Lobby = lobby;
            this.gameDict = new LinkedListDictionary<string, GameState>();
            this.changedGames = new Dictionary<string, GameState>();
            this.removedGames = new HashSet<string>();
        }
Exemplo n.º 9
0
 static void Add(LinkedListDictionary <int, List <Edge <T> > > edges, Edge <T> edge)
 {
     if (edges.TryGetValue(edge.BoundaryEdgeNumber, out List <Edge <T> > boundary))
     {
         boundary.Add(edge);
     }
     else
     {
         List <Edge <T> > newBoundary = new List <Edge <T> >();
         newBoundary.Add(edge);
         edges.Add(edge.BoundaryEdgeNumber, newBoundary);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        public static void TestDictionary()
        {
            LinkedListDictionary <string, int> dic = new LinkedListDictionary <string, int>();

            dic.Add("ss", 12);
            dic.Add("rng", 58);
            dic.Remove("ss");

            BinarySearchTreeDictionary <string, int> dictionary = new BinarySearchTreeDictionary <string, int>();

            dictionary.Add("edg", 156);
            dictionary.Add("vg", 456);
            dictionary.Set("vg", 789);
            dictionary.Remove("edg");
        }
Exemplo n.º 11
0
        static IDictionary <int, Transformation> CreatePeriodicTransformationsFrom(
            BoundaryLine[] boundary,
            IDictionary <int, int> periodicBoundaryMap)
        {
            IDictionary <int, Transformation> periodicTrafoMap = new LinkedListDictionary <int, Transformation>();

            foreach (var boundaryPair in periodicBoundaryMap)
            {
                BoundaryLine source = boundary[boundaryPair.Key];
                BoundaryLine target = BoundaryLine.GetReverse(boundary[boundaryPair.Value]);

                Transformation transformation = new BoundaryTransformation(source, target);
                periodicTrafoMap.Add(boundaryPair.Key, transformation);
            }
            return(periodicTrafoMap);
        }
Exemplo n.º 12
0
        static IDictionary <int, int> ExtractPeriodicBoundaryMap(byte[] tags)
        {
            IDictionary <int, int>  periodicBoundaryMap = new Dictionary <int, int>();
            IDictionary <byte, int> usedTags            = new LinkedListDictionary <byte, int>();

            for (int i = 0; i < tags.Length; ++i)
            {
                byte tag = tags[i];
                if (tag >= GridCommons.FIRST_PERIODIC_BC_TAG && tag < 255)
                {
                    if (usedTags.TryGetValue(tag, out int index))
                    {
                        periodicBoundaryMap.Add(i, index);
                        periodicBoundaryMap.Add(index, i);
                    }
                    else
                    {
                        usedTags.Add(tag, i);
                    };
                }
            }
            return(periodicBoundaryMap);
        }
Exemplo n.º 13
0
        static IDictionary <Corner, int> ExtractPeriodicCornerMap(
            int totalEdges,
            IDictionary <int, int> periodicBoundaryMap)
        {
            LinkedListDictionary <Corner, int> periodicCornerMap = new LinkedListDictionary <Corner, int>();
            int cornerEdge = totalEdges;

            for (int edge = 0; edge < totalEdges; ++edge)
            {
                int followingEdge = (edge + 1) % totalEdges;
                if (periodicBoundaryMap.TryGetValue(edge, out int pairedEdge) &&
                    periodicBoundaryMap.TryGetValue(followingEdge, out int pairedFollowingEdge))
                {
                    Corner periodicCorner = new Corner
                    {
                        FirstEdge  = edge,
                        SecondEdge = followingEdge
                    };
                    periodicCornerMap.Add(periodicCorner, cornerEdge);
                    ++cornerEdge;
                }
            }
            return(periodicCornerMap);
        }
Exemplo n.º 14
0
        public CellPairCollection <T> FollowBoundaryAndCollectCandidates(IEnumerable <Edge <T> > periodicEdges)
        {
            LinkedListDictionary <int, List <Edge <T> > > edges = DivideIntoBoundaries(periodicEdges);

            Debug.Assert(edges.Count % 2 == 0);
            CellPairCollection <T> candidates = new CellPairCollection <T>();


            while (edges.Count > 0)
            {
                List <Edge <T> > boundary = edges.First().Value;
                int        boundaryNumber = edges.First().Key;
                Position[] positions      = new Position[boundary.Count];
                for (int i = 0; i < boundary.Count; ++i)
                {
                    Edge <T> edge = boundary[i];
                    if (NodeIsOnRightSideOfEdge(edge.Cell.Node, edge))
                    {
                        if (edge.Twin.Cell.Node != null && NodeIsOnRightSideOfEdge(edge.Twin.Cell.Node, edge))
                        {
                            positions[i] = Position.right;
                            candidates.AddOuterSplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        }
                        else
                        {
                            positions[i] = Position.rightUnsplit;
                            candidates.AddOuterUnsplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        }
                    }
                    else
                    {
                        if (edge.Twin.Cell.Node != null && !NodeIsOnRightSideOfEdge(edge.Twin.Cell.Node, edge))
                        {
                            positions[i] = Position.left;
                            candidates.AddInnerSplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        }
                        else
                        {
                            positions[i] = Position.leftUnsplit;
                            candidates.AddInnerUnsplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        }
                    }
                }
                edges.Remove(boundaryNumber);

                boundaryNumber = map.PeriodicBoundaryCorrelation[boundaryNumber];
                boundary       = edges[boundaryNumber];
                for (int i = 0; i < boundary.Count; ++i)
                {
                    Edge <T> edge = boundary[i];
                    switch (positions[boundary.Count - 1 - i])
                    {
                    case Position.left:
                        candidates.AddOuterSplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        break;

                    case Position.right:
                        candidates.AddInnerSplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        break;

                    case Position.leftUnsplit:
                        candidates.AddOuterUnsplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        break;

                    case Position.rightUnsplit:
                        candidates.AddInnerUnsplitCell(edge.Cell, edge.BoundaryEdgeNumber);
                        break;

                    default:
                        throw new Exception();
                    }
                }
                edges.Remove(boundaryNumber);
            }
            return(candidates);
        }
Exemplo n.º 15
0
 public void SetPlaneAnchorsList(LinkedListDictionary <string, ARPlaneAnchorGameObject> listDictionary)
 {
     planeAnchorMap = listDictionary;
 }
Exemplo n.º 16
0
 public ExAnchorManager()
 {
     planeAnchorMap = new LinkedListDictionary <string, ARPlaneAnchorGameObject> ();
 }