コード例 #1
0
ファイル: QuadTree.cs プロジェクト: vazgriz/OpenGL.Net
            /// <summary>
            /// Get the sub-node where a coordinate is
            /// </summary>
            /// <param name="coord"></param>
            /// <returns></returns>
            public Node GetSubNode(QuadTreeCoord coord)
            {
                if (IsLeafNode)
                {
                    throw new InvalidOperationException("leaf node");
                }

                if (coord.Y < PivotCoord.Y)
                {
                    if (coord.X < PivotCoord.X)
                    {
                        return(mSubNodes[0]);
                    }
                    else
                    {
                        return(mSubNodes[1]);
                    }
                }
                else
                {
                    if (coord.X < PivotCoord.X)
                    {
                        return(mSubNodes[2]);
                    }
                    else
                    {
                        return(mSubNodes[3]);
                    }
                }
            }
コード例 #2
0
ファイル: QuadTree.cs プロジェクト: MagmaiKH/OpenGL.Net
			public Node(QuadTree tree, QuadTreeCoord coord, QuadTreeCoord size)
			{
				Tree = tree;
				PivotCoord = coord;
				NodeSize = size;

				if (NodeLevel < Tree.MaxDepthAllowed) {
					QuadTreeCoord size2 = size / 2.0;

					mSubNodes = new Node[] {
						new Node(tree, coord - new QuadTreeCoord(-size2.X, -size2.Y), size2),		// LL
						new Node(tree, coord - new QuadTreeCoord(+size2.X, -size2.Y), size2),		// LR
						new Node(tree, coord - new QuadTreeCoord(-size2.X, +size2.Y), size2),		// UL
						new Node(tree, coord - new QuadTreeCoord(+size2.X, +size2.Y), size2),		// UR
					};
				}
			}
コード例 #3
0
ファイル: QuadTree.cs プロジェクト: vazgriz/OpenGL.Net
            public Node(QuadTree tree, QuadTreeCoord coord, QuadTreeCoord size)
            {
                Tree       = tree;
                PivotCoord = coord;
                NodeSize   = size;

                if (NodeLevel < Tree.MaxDepthAllowed)
                {
                    QuadTreeCoord size2 = size / 2.0;

                    mSubNodes = new Node[] {
                        new Node(tree, coord - new QuadTreeCoord(-size2.X, -size2.Y), size2),                                   // LL
                        new Node(tree, coord - new QuadTreeCoord(+size2.X, -size2.Y), size2),                                   // LR
                        new Node(tree, coord - new QuadTreeCoord(-size2.X, +size2.Y), size2),                                   // UL
                        new Node(tree, coord - new QuadTreeCoord(+size2.X, +size2.Y), size2),                                   // UR
                    };
                }
            }
コード例 #4
0
ファイル: QuadTree.cs プロジェクト: MagmaiKH/OpenGL.Net
		public void FindNodes(QuadTreeCoord coord)
		{
			
		}
コード例 #5
0
ファイル: QuadTree.cs プロジェクト: MagmaiKH/OpenGL.Net
			/// <summary>
			/// Get the sub-node where a coordinate is
			/// </summary>
			/// <param name="coord"></param>
			/// <returns></returns>
			public Node GetSubNode(QuadTreeCoord coord)
			{
				if (IsLeafNode)
					throw new InvalidOperationException("leaf node");

				if (coord.Y < PivotCoord.Y) {
					if (coord.X < PivotCoord.X)
						return (mSubNodes[0]);
					else
						return (mSubNodes[1]);
				} else {
					if (coord.X < PivotCoord.X)
						return (mSubNodes[2]);
					else
						return (mSubNodes[3]);
				}
			}
コード例 #6
0
ファイル: QuadTree.cs プロジェクト: vazgriz/OpenGL.Net
 public void FindNodes(QuadTreeCoord coord)
 {
 }