public static bool TestOverlap(AXLineMask 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((VectorFP)xlMask._pos + xlMask._p); return (q.X >= 0 && q.Y >= 0 && (q.X + q.Y) <= 1); }
public static bool TestOverlap(AXLineMask xlMask, LineMask lnMask) { VectorFP c = (VectorFP)lnMask._pos + lnMask._p0; VectorFP d = c + new VectorFP(lnMask._w, lnMask._h); return xlMask.IntersectsLine(c, d); }