BuildingCoder.CmdListAllRooms.GetConvexHullOfRoomBoundary C# (CSharp) Method

GetConvexHullOfRoomBoundary() static private method

Return bounding box calculated from the room boundary segments. The lower left corner turns out to be identical with the one returned by the standard room bounding box.
static private GetConvexHullOfRoomBoundary ( IList boundary ) : List
boundary IList
return List
        static List<XYZ> GetConvexHullOfRoomBoundary(
            IList<IList<BoundarySegment>> boundary)
        {
            List<XYZ> pts = new List<XYZ>();

              foreach( IList<BoundarySegment> loop in boundary )
              {
            foreach( BoundarySegment seg in loop )
            {
              Curve c = seg.GetCurve();
              pts.AddRange( c.Tessellate() );
            }
              }
              int n = pts.Count;

              pts = new List<XYZ>(
            pts.Distinct<XYZ>( new CmdWallTopFaces
              .XyzEqualityComparer( 1.0e-4 ) ) );

              Debug.Print(
            "{0} points from tessellated room boundaries, "
            + "{1} points after cleaning up duplicates",
            n, pts.Count );

              return Util.ConvexHull( pts);
        }