/// <summary> /// /// </summary> /// <param name="line"></param> /// <param name="other"></param> /// <returns></returns> public static Vector2?IntersectionWith(this Line2 line, Line2 other) { IntersectionLine2Line2 intersectionLine2Line = new IntersectionLine2Line2(line, other); if (intersectionLine2Line.Find() && intersectionLine2Line.IntersectionType == Intersection.Type.IT_POINT) { return(new Vector2?(intersectionLine2Line.Point)); } return(null); }
/// <summary> /// 线和线相交 /// </summary> /// <param name="line"></param> /// <param name="other"></param> /// <returns></returns> public static bool Intersects(this Line2 line, Line2 other) { IntersectionLine2Line2 intersectionLine2Line = new IntersectionLine2Line2(line, other); return(intersectionLine2Line.Find()); }