本文整理匯總了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);
}