当前位置: 首页>>代码示例>>C#>>正文


C# BoundingBox.Split方法代码示例

本文整理汇总了C#中BoundingBox.Split方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingBox.Split方法的具体用法?C# BoundingBox.Split怎么用?C# BoundingBox.Split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoundingBox的用法示例。


在下文中一共展示了BoundingBox.Split方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Difference

        internal static Geometry Difference(BoundingBox lhs, BoundingBox rhs)
        {
            List<BoundingBox> components = new List<BoundingBox>();
            components.AddRange(lhs.Split(rhs.LowerLeft));
            components.AddRange(lhs.Split(rhs.LowerRight));
            components.AddRange(lhs.Split(rhs.UpperLeft));
            components.AddRange(lhs.Split(rhs.UpperRight));

            for (int i = components.Count - 1; i >= 0; i--)
            {
                if (components[i].IsEmpty || components[i].Within(rhs))
                {
                    components.RemoveAt(i);
                }
            }

            BoundingBox diff = BoundingBox.Join(components.ToArray());
            return diff.ToGeometry();
        }
开发者ID:sridhar19091986,项目名称:sharpmapcf,代码行数:19,代码来源:BoundingBoxOperations.cs

示例2: Split_ByNone_ShouldThrowArgumentException

        public void Split_ByNone_ShouldThrowArgumentException()
        {
            BoundingBox bb = new BoundingBox(new Point(3.4, 7.0, 8.0), new Point(20.0, 13.0, 10.0));

            try
            {
                var pair = bb.Split(9, Axis.None);
            }
            catch(ArgumentException ex)
            {
                Assert.AreEqual("The splitting axis should be X, Y or Z!", ex.Message);
            }
        }
开发者ID:ZombineDev,项目名称:KDTreesWPF,代码行数:13,代码来源:BoundingBoxTests.cs

示例3: Split_ByX

        public void Split_ByX()
        {
            BoundingBox bb = new BoundingBox(new Point(0.0, 0.0), new Point(10, 13));

            var pair = bb.Split(5, Axis.X);

            var a = pair.A;
            var b = pair.B;

            Assert.AreEqual(new Point(0.0, 0.0),
                a.Min);
            Assert.AreEqual(new Point(5, 13),
                a.Max);

            Assert.AreEqual(new Point(5, 0),
                b.Min);
            Assert.AreEqual(new Point(10, 13),
                b.Max);
        }
开发者ID:ZombineDev,项目名称:KDTreesWPF,代码行数:19,代码来源:BoundingBoxTests.cs

示例4: Split_ByZ

        public void Split_ByZ()
        {
            BoundingBox bb = new BoundingBox(new Point(3.4, 7.0, 8.0), new Point(20.0, 13.0, 10.0));

            var pair = bb.Split(9, Axis.Z);

            var a = pair.A;
            var b = pair.B;

            Assert.AreEqual(new Point(3.4, 7.0, 8.0),
                a.Min);
            Assert.AreEqual( new Point(20.0, 13.0, 9.0),
                a.Max);

            Assert.AreEqual(new Point(3.4, 7.0, 9.0),
                b.Min);
            Assert.AreEqual(new Point(20.0, 13.0, 10.0),
                b.Max);
        }
开发者ID:ZombineDev,项目名称:KDTreesWPF,代码行数:19,代码来源:BoundingBoxTests.cs


注:本文中的BoundingBox.Split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。