UpdateInfo() public method

public UpdateInfo ( ) : void
return void
示例#1
0
        /** Queries the tree for the best node, searching within a circle around \a p with the specified radius */
        public NNInfo QueryCircle(Vector3 p, float radius, NNConstraint constraint)
        {
            BBTreeBox c = root;

            if (c == null)
            {
                return(null);
            }

#if DEBUG
            Vector3 prev = new Vector3(1, 0, 0) * radius + p;
            for (double i = 0; i < Math.PI * 2; i += Math.PI / 50.0)
            {
                Vector3 cpos = new Vector3((float)Math.Cos(i), 0, (float)Math.Sin(i)) * radius + p;
                Debug.DrawLine(prev, cpos, Color.yellow);
                prev = cpos;
            }
#endif

            NNInfo nnInfo = new NNInfo(null);

            SearchBoxCircle(c, p, radius, constraint, ref nnInfo);

            nnInfo.UpdateInfo();

            return(nnInfo);
        }
示例#2
0
        public NNInfo QueryCircle(Vector3 p, float radius, NNConstraint constraint)
        {
            if (this.count == 0)
            {
                return(new NNInfo(null));
            }
            NNInfo result = new NNInfo(null);

            this.SearchBoxCircle(0, p, radius, constraint, ref result);
            result.UpdateInfo();
            return(result);
        }
示例#3
0
        public NNInfo Query(Vector3 p, NNConstraint constraint)
        {
            if (this.count == 0)
            {
                return(new NNInfo(null));
            }
            NNInfo result = default(NNInfo);

            this.SearchBox(0, p, constraint, ref result);
            result.UpdateInfo();
            return(result);
        }
示例#4
0
        public NNInfo Query(Vector3 p, NNConstraint constraint)
        {
            if (this.count == 0)
            {
                return(new NNInfo(null));
            }
            NNInfo nnInfo = new NNInfo();

            this.SearchBox(0, p, constraint, ref nnInfo);
            nnInfo.UpdateInfo();
            return(nnInfo);
        }
示例#5
0
文件: BBTree.cs 项目: fusa-nova/RTS
        /** Queries the tree for the best node, searching within a circle around \a p with the specified radius.
         * Will fill in both the constrained node and the not constrained node in the NNInfo.
         *
         * \see QueryClosest
         */
        public NNInfo QueryCircle(Vector3 p, float radius, NNConstraint constraint)
        {
            if (count == 0)
            {
                return(new NNInfo(null));
            }

            var nnInfo = new NNInfo(null);

            SearchBoxCircle(0, p, radius, constraint, ref nnInfo);

            nnInfo.UpdateInfo();

            return(nnInfo);
        }
示例#6
0
		public NNInfo Query (Vector3 p, NNConstraint constraint) {
			
			BBTreeBox c = root;
			
			if (c == null) {
				return new NNInfo();
			}
			
			NNInfo nnInfo = new NNInfo ();
			
			SearchBox (c,p, constraint, ref nnInfo);
			
			nnInfo.UpdateInfo ();
			
			return nnInfo;
		}
示例#7
0
        public NNInfo Query(Vector3 p, NNConstraint constraint)
        {
            BBTreeBox c = root;

            if (c == null)
            {
                return(null);
            }

            NNInfo nnInfo = new NNInfo();

            SearchBox(c, p, constraint, ref nnInfo);

            nnInfo.UpdateInfo();

            return(nnInfo);
        }
        public override NNInfo GetNearestForce(Vector3 position, NNConstraint constraint)
        {
            if (nodes == null)
            {
                return(new NNInfo());
            }

            if (optimizeForSparseGraph)
            {
                return(new NNInfo(lookupTree.GetNearest((Int3)position, constraint)));
            }

            float maxDistSqr = constraint == null || constraint.constrainDistance ? AstarPath.active.maxNearestNodeDistanceSqr : float.PositiveInfinity;

            var   nnInfo       = new NNInfo(null);
            float minDist      = float.PositiveInfinity;
            float minConstDist = float.PositiveInfinity;

            for (int i = 0; i < nodeCount; i++)
            {
                PointNode node = nodes[i];
                float     dist = (position - (Vector3)node.position).sqrMagnitude;

                if (dist < minDist)
                {
                    minDist     = dist;
                    nnInfo.node = node;
                }

                if (dist < minConstDist && dist < maxDistSqr && (constraint == null || constraint.Suitable(node)))
                {
                    minConstDist           = dist;
                    nnInfo.constrainedNode = node;
                }
            }

            nnInfo.UpdateInfo();
            return(nnInfo);
        }
示例#9
0
		/** Queries the tree for the best node, searching within a circle around \a p with the specified radius.
		  * Will fill in both the constrained node and the not constrained node in the NNInfo.
		  * 
		  * \see QueryClosest
		  */
		public NNInfo QueryCircle (Vector3 p, float radius, NNConstraint constraint) {
			BBTreeBox c = root;
			
			if (c == null) {
				return new NNInfo();
			}
			
#if ASTARDEBUG
			Vector3 prev = new Vector3 (1,0,0)*radius+p;
			for (double i=0;i< Math.PI*2; i += Math.PI/50.0) {
				Vector3 cpos = new Vector3 ((float)Math.Cos (i),0,(float)Math.Sin (i))*radius+p;
				Debug.DrawLine (prev,cpos,Color.yellow);
				prev = cpos;
			}
#endif
			
			NNInfo nnInfo = new NNInfo (null);
			
			SearchBoxCircle (c,p, radius, constraint, ref nnInfo);
			
			nnInfo.UpdateInfo ();
			
			return nnInfo;
		}
示例#10
0
		/** Queries the tree for the best node, searching within a circle around \a p with the specified radius.
		  * Will fill in both the constrained node and the not constrained node in the NNInfo.
		  *
		  * \see QueryClosest
		  */
		public NNInfo QueryCircle (Vector3 p, float radius, NNConstraint constraint) {

			if ( count == 0 ) return new NNInfo(null);

			var nnInfo = new NNInfo (null);

			SearchBoxCircle (0,p, radius, constraint, ref nnInfo);

			nnInfo.UpdateInfo ();

			return nnInfo;
		}
示例#11
0
		public NNInfo Query (Vector3 p, NNConstraint constraint) {

			if ( count == 0 ) return new NNInfo(null);

			var nnInfo = new NNInfo ();

			SearchBox (0,p, constraint, ref nnInfo);

			nnInfo.UpdateInfo ();

			return nnInfo;
		}
示例#12
0
 public NNInfo QueryCircle(Vector3 p, float radius, NNConstraint constraint)
 {
     if (this.count == 0)
     {
         return new NNInfo(null);
     }
     NNInfo result = new NNInfo(null);
     this.SearchBoxCircle(0, p, radius, constraint, ref result);
     result.UpdateInfo();
     return result;
 }