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