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


C# Box.CoordinateIsInside方法代码示例

本文整理汇总了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;
 }
开发者ID:KonstantinUb,项目名称:sledge,代码行数:19,代码来源:MapObject.cs

示例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;
 }
开发者ID:KonstantinUb,项目名称:sledge,代码行数:35,代码来源:MapObject.cs


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