public static bool TestOverlap(LineMask lnMask, TriangleMask triMask) { VectorFP a = (VectorFP)triMask._pos + triMask._p0; VectorFP b = (VectorFP)triMask._pos + triMask._p1; VectorFP c = (VectorFP)triMask._pos + triMask._p2; //TestResult t = lnMask.LineIntersect(a, b); if (lnMask.IntersectsLine(a, b) || lnMask.IntersectsLine(b, c) || lnMask.IntersectsLine(a, c)) { return true; } // Check for containment VectorFP r = triMask.Barycentric((VectorFP)lnMask._pos + lnMask._p0); return (r.X >= 0 && r.Y >= 0 && (r.X + r.Y) <= 1); }
public static bool TestOverlap(LineMask lnMask1, LineMask lnMask2) { VectorFP a = (VectorFP)lnMask1._pos + lnMask1._p0; VectorFP b = a + new VectorFP(lnMask1._w, lnMask1._h); return lnMask2.IntersectsLine(a, b); }