/// <summary> /// 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. /// </summary> static List <XYZ> GetConvexHullOfRoomBoundary( IList <IList <BoundarySegment> > boundary) { List <XYZ> convex_hull = new List <XYZ>(); if (0 < boundary.Count) { 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); convex_hull = Util.ConvexHull(pts); } return(convex_hull); }