public static bool SegmentIntersect(CCPoint A, CCPoint B, CCPoint C, CCPoint D) { float single; float single1; if (CCPoint.LineIntersect(A, B, C, D, out single, out single1) && single >= 0f && single <= 1f && single1 >= 0f && single1 <= 1f) { return(true); } return(false); }
public static CCPoint IntersectPoint(CCPoint A, CCPoint B, CCPoint C, CCPoint D) { float single; float single1; if (!CCPoint.LineIntersect(A, B, C, D, out single, out single1)) { return(CCPoint.CCPointZero); } CCPoint cCPoint = new CCPoint() { x = A.x + single * (B.x - A.x), y = A.y + single * (B.y - A.y) }; return(cCPoint); }