本文整理汇总了C#中Sledge.DataStructures.Geometric.Box.CoordinateIsInside方法的典型用法代码示例。如果您正苦于以下问题:C# Box.CoordinateIsInside方法的具体用法?C# Box.CoordinateIsInside怎么用?C# Box.CoordinateIsInside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sledge.DataStructures.Geometric.Box
的用法示例。
在下文中一共展示了Box.CoordinateIsInside方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllNodesWithCentersContainedWithin
/// <summary>
/// Get all the nodes starting from this node with the centers contained within a box.
/// </summary>
/// <param name="box">The containing box</param>
/// <param name="allowCodeHidden">Set to true to include nodes that have been hidden by code</param>
/// <param name="allowVisgroupHidden">Set to true to include nodes that have been hidden by the user</param>
/// <returns>A list of all the descendants that have centers inside the box.</returns>
public IEnumerable<MapObject> GetAllNodesWithCentersContainedWithin(Box box, bool allowCodeHidden = false, bool allowVisgroupHidden = false)
{
var list = new List<MapObject>();
if ((!allowCodeHidden && IsCodeHidden) || (!allowVisgroupHidden && IsVisgroupHidden)) return list;
if (!(this is World))
{
if (BoundingBox == null || !box.CoordinateIsInside(BoundingBox.Center)) return list;
if ((this is Solid || this is Entity) && !Children.Any()) list.Add(this);
}
list.AddRange(GetChildren().SelectMany(x => x.GetAllNodesWithCentersContainedWithin(box, allowCodeHidden, allowVisgroupHidden)));
return list;
}
示例2: GetAllNodesIntersecting2DLineTest
/// <summary>
/// Get all the solid nodes starting from this node where the
/// edges of the solid intersect with the provided box.
/// </summary>
/// <param name="box">The intersection box</param>
/// <param name="includeOrigin">Set to true to test against the object origins as well</param>
/// <param name="forceOrigin">Set to true to only test against the object origins and ignore other tests</param>
/// <param name="allowCodeHidden">Set to true to include nodes that have been hidden by code</param>
/// <param name="allowVisgroupHidden">Set to true to include nodes that have been hidden by the user</param>
/// <returns>A list of all the solid descendants where the edges of the solid intersect with the box.</returns>
public IEnumerable<MapObject> GetAllNodesIntersecting2DLineTest(Box box, bool includeOrigin = false, bool forceOrigin = false, bool allowCodeHidden = false, bool allowVisgroupHidden = false)
{
var list = new List<MapObject>();
if (!(this is World) && (allowCodeHidden || !IsCodeHidden) && (allowVisgroupHidden || !IsVisgroupHidden))
{
if (BoundingBox == null || !BoundingBox.IntersectsWith(box)) return list;
// Solids: Match face edges against box
if (!forceOrigin && this is Solid && ((Solid)this).Faces.Any(f => f.IntersectsWithLine(box)))
{
list.Add(this);
}
// Point entities: Match bounding box edges against box
else if (!forceOrigin && this is Entity && !Children.Any() && BoundingBox.GetBoxLines().Any(box.IntersectsWith))
{
list.Add(this);
}
// Origins: Match bounding box center against box (for solids and point entities)
else if ((includeOrigin || forceOrigin) && !Children.Any() && (this is Solid || this is Entity) && box.CoordinateIsInside(BoundingBox.Center))
{
list.Add(this);
}
}
list.AddRange(GetChildren().SelectMany(x => x.GetAllNodesIntersecting2DLineTest(box, includeOrigin, forceOrigin, allowCodeHidden, allowVisgroupHidden)));
return list;
}