public static bool TestOverlap(AXLine xlMask, TriangleMask triMask) { VectorFP a = (VectorFP)triMask._pos + triMask._p0; VectorFP b = (VectorFP)triMask._pos + triMask._p1; VectorFP c = (VectorFP)triMask._pos + triMask._p2; if (xlMask.IntersectsLine(a, b) || xlMask.IntersectsLine(b, c) || xlMask.IntersectsLine(a, c)) { return true; } VectorFP q = triMask.Barycentric(xlMask.LeftPoint); return (q.X >= 0 && q.Y >= 0 && (q.X + q.Y) <= 1); }
public static bool TestOverlap(AXLine xlMask, LineMask lnMask) { VectorFP c = (VectorFP)lnMask._pos + lnMask._p0; VectorFP d = c + new VectorFP(lnMask._w, lnMask._h); return xlMask.IntersectsLine(c, d); }