public void Contains_test(
            double rx, double ry, double rw, double rh,
            double x, double y, bool contains)
        {
            Hyperrectangle hr = new Hyperrectangle(rx, ry, rw, rh);
            RectangleF     rf = new RectangleF((float)rx, (float)ry, (float)rw, (float)rh);

            bool expected = rf.Contains((float)x, (float)y);
            bool actual   = hr.Contains(x, y);

            Assert.AreEqual(expected, actual);
            Assert.AreEqual(expected, contains);
        }
        public void Contains_test(
            int rx, int ry, int rw, int rh,
            int x, int y, bool contains)
        {
            Hyperrectangle hr = new Hyperrectangle(rx, ry, rw, rh);
            Rectangle      rf = new Rectangle(rx, ry, rw, rh);

            bool expected = rf.Contains(x, y);
            bool actual   = hr.Contains(x, y);

            Assert.AreEqual(expected, actual);
            Assert.AreEqual(expected, contains);
        }
示例#3
0
        private IList <TNode> getNodesInsideRegion(TNode node, Hyperrectangle region, Hyperrectangle subRegion)
        {
            var result = new List <TNode>();

            if (node != null && region.IntersectsWith(subRegion))
            {
                if (region.Contains(node.Position))
                {
                    result.Add(node);
                }

                result.AddRange(getNodesInsideRegion(node.Left, region, leftRect(subRegion, node)));
                result.AddRange(getNodesInsideRegion(node.Right, region, rightRect(subRegion, node)));
            }

            return(result);
        }