當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。