ContainsPoint() public static method

public static ContainsPoint ( Int2 a, Int2 b, Int2 c, Int2 p ) : bool
a Int2
b Int2
c Int2
p Int2
return bool
Ejemplo n.º 1
0
        public bool Contains(GraphNode node)
        {
            Vector3 point = (Vector3)node.position;

            //Debug.DrawRay (node.position,-Vector3.up*2,Color.magenta);

            if (convex)
            {
                if (_convexPoints == null)
                {
                    return(false);
                }

                for (int i = 0, j = _convexPoints.Length - 1; i < _convexPoints.Length; j = i, i++)
                {
                    if (Polygon.Left(_convexPoints[i], _convexPoints[j], point))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (_points == null)
                {
                    return(false);
                }

                return(Polygon.ContainsPoint(_points, point));
            }

            //Debug.DrawRay (node.position,Vector3.up*2,Color.blue);

            return(true);
        }
Ejemplo n.º 2
0
 public bool Contains(Vector3 point)
 {
     if (this.convex)
     {
         if (this._convexPoints == null)
         {
             return(false);
         }
         int index = 0;
         int num2  = this._convexPoints.Length - 1;
         while (index < this._convexPoints.Length)
         {
             if (Polygon.Left(this._convexPoints[index], this._convexPoints[num2], point))
             {
                 return(false);
             }
             num2 = index;
             index++;
         }
         return(true);
     }
     if (this._points == null)
     {
         return(false);
     }
     return(Polygon.ContainsPoint(this._points, point));
 }
Ejemplo n.º 3
0
        public bool Contains(Vector3 point)
        {
            if (convex)
            {
                if (_convexPoints == null)
                {
                    return(false);
                }

                for (int i = 0, j = _convexPoints.Length - 1; i < _convexPoints.Length; j = i, i++)
                {
                    if (Polygon.Left(_convexPoints[i], _convexPoints[j], point))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (_points == null)
                {
                    return(false);
                }

                return(Polygon.ContainsPoint(_points, point));
            }

            return(true);
        }
Ejemplo n.º 4
0
        public TriangleMeshNode GetLocatedByRasterizer(Int3 position)
        {
            TriangleMeshNode result = null;

            if (this.rasterizer != null)
            {
                List <object> located = this.rasterizer.GetLocated(position);
                if (located != null)
                {
                    for (int i = 0; i < located.Count; i++)
                    {
                        TriangleMeshNode triangleMeshNode = located[i] as TriangleMeshNode;
                        if (triangleMeshNode == null)
                        {
                            break;
                        }
                        Int3 a;
                        Int3 b;
                        Int3 c;
                        triangleMeshNode.GetPoints(out a, out b, out c);

                        AStarDebug.DrawTriangle(0, a, b, c);
                        if (Polygon.ContainsPoint(a, b, c, position))
                        {
                            result = triangleMeshNode;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
        // Token: 0x06000142 RID: 322 RVA: 0x0000DFB4 File Offset: 0x0000C3B4
        public bool Contains(GraphNode node)
        {
            Vector3 p = (Vector3)node.position;

            if (!this.convex)
            {
                return(this._points != null && Polygon.ContainsPoint(this._points, p));
            }
            if (this._convexPoints == null)
            {
                return(false);
            }
            int i   = 0;
            int num = this._convexPoints.Length - 1;

            while (i < this._convexPoints.Length)
            {
                if (Polygon.Left(this._convexPoints[i], this._convexPoints[num], p))
                {
                    return(false);
                }
                num = i;
                i++;
            }
            return(true);
        }
Ejemplo n.º 6
0
        public TriangleMeshNode GetLocatedByRasterizer(VInt3 position)
        {
            TriangleMeshNode result = null;

            if (this.rasterizer != null)
            {
                List <object> located = this.rasterizer.GetLocated(position);
                if (located != null)
                {
                    for (int i = 0; i < located.get_Count(); i++)
                    {
                        TriangleMeshNode triangleMeshNode = located.get_Item(i) as TriangleMeshNode;
                        if (triangleMeshNode == null)
                        {
                            break;
                        }
                        VInt3 a;
                        VInt3 b;
                        VInt3 c;
                        triangleMeshNode.GetPoints(out a, out b, out c);
                        if (Polygon.ContainsPoint(a, b, c, position))
                        {
                            result = triangleMeshNode;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 7
0
        public bool Contains(Vector3 point)
        {
            if (convex)
            {
                if (_convexPoints == null)
                {
                    return(false);
                }

                for (int i = 0, j = _convexPoints.Length - 1; i < _convexPoints.Length; j = i, i++)
                {
                    if (VectorMath.RightOrColinearXZ(_convexPoints[i], _convexPoints[j], point))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                return(_points != null && Polygon.ContainsPoint(_points, point));
            }
        }