本文整理汇总了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();
}
示例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);
}
}
示例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);
}
示例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);
}