Example #1
0
 // Triangle -- [____] Collision Tests
 public static bool TestOverlapEdge(TriangleMask triMask, AXLineMask xlMAsk)
 {
     return TestOverlapEdge(xlMAsk, triMask);
 }
Example #2
0
        public static bool TestOverlapEdge(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.IntersectsLineEdge(a, b) || xlMask.IntersectsLineEdge(b, c) || xlMask.IntersectsLineEdge(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);
        }
Example #3
0
 // AABB -- [____] Collision Tests
 public static bool TestOverlapEdge(AABBMask rMask, AXLineMask xlMask)
 {
     return TestOverlapEdge(xlMask, rMask);
 }
Example #4
0
        public static bool TestOverlapEdge(PointMask ptMask, AXLineMask xlMask)
        {
            VectorFP p1 = (VectorFP)ptMask._pos + ptMask._point;

            return TestOverlapEdge(xlMask, p1.X, p1.Y);
        }
Example #5
0
        // AXLine -- [____] Collision + Edge Tests
        public static bool TestOverlapEdge(AXLineMask xlMask, AABBMask rMask)
        {
            FPInt py = xlMask._pos.Y + xlMask._p.Y;
            FPInt px1 = xlMask._pos.X + xlMask._p.X;
            FPInt px2 = px1 + xlMask._w;

            VectorFP r1 = (VectorFP)rMask._pos + rMask._point;
            VectorFP r2 = r1 + new VectorFP(rMask._w, rMask._h);

            return !(py > r2.Y || py < r1.Y || px1 > r2.X || px2 < r1.X);
        }
Example #6
0
 public static bool TestOverlap(LineMask lnMask, AXLineMask xlMask)
 {
     return TestOverlap(xlMask, lnMask);
 }
Example #7
0
        public static bool TestOverlapEdge(AXLineMask xlMask, FPInt x, FPInt y)
        {
            VectorFP p2 = (VectorFP)xlMask._pos + xlMask._p;

            return (y == p2.Y && x >= p2.X && x <= p2.X + xlMask._w);
        }
Example #8
0
 public static bool TestOverlap(PointMask ptMask, AXLineMask xlMask)
 {
     return false;
 }
Example #9
0
 public static bool TestOverlap(AYLine ylMask, AXLineMask xlMask)
 {
     return TestOverlap(xlMask, ylMask);
 }
Example #10
0
        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);
        }
Example #11
0
 public static bool TestOverlap(AXLine xlMask1, AXLineMask xlMask2)
 {
     return false;
 }
Example #12
0
        public static bool TestOverlap(AXLineMask xlMask, AYLine ylMask)
        {
            VectorFP c = (VectorFP)xlMask._pos + xlMask._p;
            VectorFP d = c + new VectorFP(xlMask._w, 0);

            return ylMask.IntersectsLine(c, d);
        }
Example #13
0
 public static bool TestOverlap(AXLineMask xlMask, CircleMask cMask)
 {
     return TestOverlap(cMask, xlMask);
 }
Example #14
0
 // AXLine -- [____] Collision Tests
 public static bool TestOverlap(AXLineMask xlMask, PointMask ptMask)
 {
     return TestOverlap(ptMask, xlMask);
 }
Example #15
0
        public static bool TestOverlap(CircleMask cMask, AXLineMask xlMask)
        {
            VectorFP c1 = (VectorFP)cMask._pos + cMask._p;
            VectorFP c2 = xlMask.ClosestPoint(c1);

            FPInt d2 = VectorFP.DistanceSquared(c1, c2);
            FPInt r2 = cMask._radius * cMask._radius;

            return (r2 < d2);
        }
Example #16
0
        public override object Clone()
        {
            AXLineMask mask = new AXLineMask(_p, _w);
            mask._pos = _pos;

            return mask;
        }