public bool Test(AYLine line)
        {
            foreach (TileCollisionManager manager in _managers) {
                if (manager.OverlapsAny(line))
                    return true;
            }

            return false;
        }
Example #2
0
        public static bool TestOverlapEdge(AYLine ylMask, TriangleMask triMask)
        {
            VectorFP a = (VectorFP)triMask._pos + triMask._p0;
            VectorFP b = (VectorFP)triMask._pos + triMask._p1;
            VectorFP c = (VectorFP)triMask._pos + triMask._p2;

            if (ylMask.IntersectsLineEdge(a, b) || ylMask.IntersectsLineEdge(b, c) || ylMask.IntersectsLineEdge(a, c)) {
                return true;
            }

            VectorFP q = triMask.Barycentric(ylMask.TopPoint);

            return (q.X >= 0 && q.Y >= 0 && (q.X + q.Y) <= 1);
        }
Example #3
0
        // AYLine -- [____] Collision + Edge Tests
        public static bool TestOverlapEdge(AYLine ylMask, AABBMask rMask)
        {
            VectorFP r1 = (VectorFP)rMask._pos + rMask._point;
            VectorFP r2 = r1 + new VectorFP(rMask._w, rMask._h);

            return !(ylMask.Top > r2.Y || ylMask.Bottom < r1.Y || ylMask.X > r2.X || ylMask.X < r1.X);
        }
Example #4
0
        public static bool TestOverlapEdge(PointMask ptMask, AYLine ylMask)
        {
            VectorFP p1 = (VectorFP)ptMask._pos + ptMask._point;

            return TestOverlapEdge(ylMask, p1.X, p1.Y);
        }
Example #5
0
 public static bool TestOverlapEdge(AYLine ylMask, FPInt x, FPInt y)
 {
     return (x == ylMask.X && y >= ylMask.Top && y <= ylMask.Bottom);
 }
Example #6
0
        public static bool TestOverlap(AYLine yl, CompositeMask comMask)
        {
            RectangleFP comBounds = comMask.Bounds;
            if (yl.X >= comBounds.Right || yl.X <= comBounds.Left || yl.Bottom <= comBounds.Top || yl.Top >= comBounds.Bottom) {
                return false;
            }

            foreach (Mask m in comMask._components) {
                if (m.TestOverlap(yl)) {
                    return true;
                }
            }

            return false;
        }
Example #7
0
 public override bool TestOverlapEdge(AYLine line)
 {
     return Collision.TestOverlapEdge(line, this);
 }
Example #8
0
 public static bool TestOverlap(AYLine ylMask1, AYLineMask ylMask2)
 {
     return false;
 }
Example #9
0
        public static bool TestOverlap(AYLine ylMask, LineMask lnMask)
        {
            VectorFP c = (VectorFP)lnMask._pos + lnMask._p0;
            VectorFP d = c + new VectorFP(lnMask._w, lnMask._h);

            return ylMask.IntersectsLine(c, d);
        }
Example #10
0
 public static bool TestOverlap(AYLine ylMask, CircleMask cMask)
 {
     return TestOverlap(cMask, ylMask);
 }
Example #11
0
 public static bool TestOverlap(AYLine ylMask, AXLineMask xlMask)
 {
     return TestOverlap(xlMask, ylMask);
 }
Example #12
0
 public static bool TestOverlap(AYLine ylMask, PointMask ptMask)
 {
     return TestOverlap(ptMask, ylMask);
 }
Example #13
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 #14
0
        public static bool TestOverlap(CircleMask cMask, AYLine yl)
        {
            VectorFP c1 = (VectorFP)cMask._pos + cMask._p;
            VectorFP c2 = yl.ClosestPoint(c1);

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

            return (r2 < d2);
        }
Example #15
0
 public static bool TestOverlapEdge(AABBMask rMask, AYLine ylMask)
 {
     return TestOverlapEdge(ylMask, rMask);
 }
Example #16
0
 public static bool TestOverlap(LineMask lnMask, AYLine ylMask)
 {
     return TestOverlap(ylMask, lnMask);
 }
Example #17
0
 public static bool TestOverlapEdge(TriangleMask triMask, AYLine ylMAsk)
 {
     return TestOverlapEdge(ylMAsk, triMask);
 }
Example #18
0
 public static bool TestOverlap(PointMask ptMask, AYLine yl)
 {
     return false;
 }
Example #19
0
        public bool OverlapsEdgeAny(AYLine line)
        {
            int x = Math.Max(0, Math.Min(_width - 1, (int)(line.X.Floor / _tileWidth)));
            int minY = Math.Max(0, (int)(line.Top / _tileHeight));
            int maxY = Math.Min(_height - 1, (int)(line.Bottom / _tileHeight));

            for (int y = minY; y <= maxY; y++) {
                if (_grid[x, y] != null && _grid[x, y].TestOverlapEdge(line))
                    return true;
            };

            return false;
        }
Example #20
0
 public virtual bool TestOverlap(AYLine line)
 {
     return false;
 }