NodeIntersectsCircle() публичный Метод

public NodeIntersectsCircle ( Pathfinding.MeshNode node, Vector3 p, float radius ) : bool
node Pathfinding.MeshNode
p Vector3
radius float
Результат bool
Пример #1
0
 private void SearchBoxClosest(int boxi, Vector3 p, ref float closestDist, NNConstraint constraint, ref NNInfoInternal nnInfo)
 {
     BBTree.BBTreeBox bbtreeBox = this.arr[boxi];
     if (bbtreeBox.node != null)
     {
         if (BBTree.NodeIntersectsCircle(bbtreeBox.node, p, closestDist))
         {
             Vector3 vector = bbtreeBox.node.ClosestPointOnNode(p);
             if (constraint == null || constraint.Suitable(bbtreeBox.node))
             {
                 float sqrMagnitude = (vector - p).sqrMagnitude;
                 if (nnInfo.constrainedNode == null || sqrMagnitude < closestDist * closestDist)
                 {
                     nnInfo.constrainedNode      = bbtreeBox.node;
                     nnInfo.constClampedPosition = vector;
                     closestDist = (float)Math.Sqrt((double)sqrMagnitude);
                 }
             }
         }
     }
     else
     {
         if (BBTree.RectIntersectsCircle(this.arr[bbtreeBox.left].rect, p, closestDist))
         {
             this.SearchBoxClosest(bbtreeBox.left, p, ref closestDist, constraint, ref nnInfo);
         }
         if (BBTree.RectIntersectsCircle(this.arr[bbtreeBox.right].rect, p, closestDist))
         {
             this.SearchBoxClosest(bbtreeBox.right, p, ref closestDist, constraint, ref nnInfo);
         }
     }
 }
Пример #2
0
 private void SearchBoxCircle(int boxi, Vector3 p, float radius, NNConstraint constraint, ref NNInfo nnInfo)
 {
     BBTree.BBTreeBox bBTreeBox = this.arr[boxi];
     if (bBTreeBox.node != null)
     {
         if (BBTree.NodeIntersectsCircle(bBTreeBox.node, p, radius))
         {
             Vector3 vector       = bBTreeBox.node.ClosestPointOnNode(p);
             float   sqrMagnitude = (vector - p).sqrMagnitude;
             if (nnInfo.node == null)
             {
                 nnInfo.node            = bBTreeBox.node;
                 nnInfo.clampedPosition = vector;
             }
             else if (sqrMagnitude < (nnInfo.clampedPosition - p).sqrMagnitude)
             {
                 nnInfo.node            = bBTreeBox.node;
                 nnInfo.clampedPosition = vector;
             }
             if (constraint == null || constraint.Suitable(bBTreeBox.node))
             {
                 if (nnInfo.constrainedNode == null)
                 {
                     nnInfo.constrainedNode      = bBTreeBox.node;
                     nnInfo.constClampedPosition = vector;
                 }
                 else if (sqrMagnitude < (nnInfo.constClampedPosition - p).sqrMagnitude)
                 {
                     nnInfo.constrainedNode      = bBTreeBox.node;
                     nnInfo.constClampedPosition = vector;
                 }
             }
         }
         return;
     }
     if (BBTree.RectIntersectsCircle(this.arr[bBTreeBox.left].rect, p, radius))
     {
         this.SearchBoxCircle(bBTreeBox.left, p, radius, constraint, ref nnInfo);
     }
     if (BBTree.RectIntersectsCircle(this.arr[bBTreeBox.right].rect, p, radius))
     {
         this.SearchBoxCircle(bBTreeBox.right, p, radius, constraint, ref nnInfo);
     }
 }