Pathfinding.Polygon.IntersectionPoint C# (CSharp) Method

IntersectionPoint() public static method

public static IntersectionPoint ( Vector2 start1, Vector2 end1, Vector2 start2, Vector2 end2 ) : Vector2
start1 Vector2
end1 Vector2
start2 Vector2
end2 Vector2
return Vector2
		public static Vector2 IntersectionPoint (Vector2 start1, Vector2 end1, Vector2 start2, Vector2 end2) {
			bool s;
			return IntersectionPoint (start1,end1,start2,end2, out s);
		}
		

Same methods

Polygon::IntersectionPoint ( Vector2 start1, Vector2 end1, Vector2 start2, Vector2 end2, bool &intersects ) : Vector2
Polygon::IntersectionPoint ( Vector3 start1, Vector3 end1, Vector3 start2, Vector3 end2 ) : Vector3
Polygon::IntersectionPoint ( Vector3 start1, Vector3 end1, Vector3 start2, Vector3 end2, bool &intersects ) : Vector3

Usage Example

Ejemplo n.º 1
0
        private TriangleMeshNode checkObjIntersects(ref int edge, Int3 start, Int3 end, int gridX, int gridY)
        {
            List <object> objs = this.rasterizer.GetObjs(gridX, gridY);

            if (objs == null || objs.Count == 0)
            {
                return(null);
            }
            Int3[]           array            = new Int3[3];
            TriangleMeshNode triangleMeshNode = null;
            int  num  = -1;
            long num2 = 9223372036854775807L;

            for (int i = 0; i < objs.Count; i++)
            {
                TriangleMeshNode triangleMeshNode2 = objs[i] as TriangleMeshNode;
                triangleMeshNode2.GetPoints(out array[0], out array[1], out array[2]);
                for (int j = 0; j < 3; j++)
                {
                    int num3 = j;
                    int num4 = (j + 1) % 3;
                    if (Polygon.Intersects(array[num3], array[num4], start, end))
                    {
                        bool flag;
                        Int3 vInt = Polygon.IntersectionPoint(ref array[num3], ref array[num4], ref start, ref end, out flag);

                        long num5 = start.XZSqrMagnitude(ref vInt);
                        if (num5 < num2)
                        {
                            num2             = num5;
                            triangleMeshNode = triangleMeshNode2;
                            num = j;
                        }
                    }
                }
            }
            if (num != -1 && triangleMeshNode != null)
            {
                edge = num;
                return(triangleMeshNode);
            }
            return(null);
        }
All Usage Examples Of Pathfinding.Polygon::IntersectionPoint