public static PanelType PanelType(this surfaceTypeEnum surfaceTypeEnum) { switch (surfaceTypeEnum) { case surfaceTypeEnum.Air: return(Analytical.PanelType.Air); case surfaceTypeEnum.Ceiling: return(Analytical.PanelType.Ceiling); case surfaceTypeEnum.EmbeddedColumn: return(Analytical.PanelType.Shade); case surfaceTypeEnum.ExposedFloor: return(Analytical.PanelType.FloorExposed); case surfaceTypeEnum.ExteriorWall: return(Analytical.PanelType.WallExternal); case surfaceTypeEnum.FreestandingColumn: return(Analytical.PanelType.Shade); case surfaceTypeEnum.InteriorFloor: return(Analytical.PanelType.FloorInternal); case surfaceTypeEnum.InteriorWall: return(Analytical.PanelType.WallInternal); case surfaceTypeEnum.RaisedFloor: return(Analytical.PanelType.FloorRaised); case surfaceTypeEnum.Roof: return(Analytical.PanelType.Roof); case surfaceTypeEnum.Shade: return(Analytical.PanelType.Shade); case surfaceTypeEnum.SlabOnGrade: return(Analytical.PanelType.SlabOnGrade); case surfaceTypeEnum.UndergroundCeiling: return(Analytical.PanelType.UndergroundCeiling); case surfaceTypeEnum.UndergroundSlab: return(Analytical.PanelType.UndergroundSlab); case surfaceTypeEnum.UndergroundWall: return(Analytical.PanelType.UndergroundWall); } return(Analytical.PanelType.Undefined); }
static public Dictionary <string, double> GetWidthandHeight(EPObj.MemorySafe_Surface epsurface, surfaceTypeEnum surftype) { Dictionary <string, double> WH = new Dictionary <string, double>(); List <EPObj.MemorySafe_CartCoord> coords = epsurface.SurfaceCoords; //we use a very simple algorithm where we find the area and the max height //we divide the area by the max height, and this is our width. //this helps us cover the case of non-vertical surfaces, and polygons that //are not rectangles double width = 0; double height = 0; for (int i = 0; i < (coords.Count() - 1); i++) { double dx = Math.Abs(coords[i].X - coords[i + 1].X); double dy = Math.Abs(coords[i].Y - coords[i + 1].Y); double dz = Math.Abs(coords[i].Z - coords[i + 1].Z); //get the height if (surftype == surfaceTypeEnum.ExteriorWall || surftype == surfaceTypeEnum.InteriorWall || surftype == surfaceTypeEnum.UndergroundWall) { if (dz == 0) { continue; } else { if (dx == 0 && dy == 0) { if (dz > height) { height = dz; } else { continue; } } else { //can you prove this somehow? double dist = Math.Sqrt(Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)) + Math.Pow(dz, 2)); if (dist > height) { height = dist; } else { continue; } } } } else { if (dz == 0) { double dist = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)); if (dist > height) { height = dist; } else { continue; } } else //it is tilted { double dist = Math.Sqrt(Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)) + Math.Pow(dz, 2)); if (dist > height) { height = dist; } else { continue; } } } //this simplifies the definition of width and area greatly double area = EPObj.GetAreaofSurface(epsurface); if (height != 0) { width = area / height; } } WH.Add("width", width); WH.Add("height", height); return(WH); }
public static Dictionary<string, double> GetWidthandHeight(EPObj.MemorySafe_Surface epsurface, surfaceTypeEnum surftype) { Dictionary<string, double> WH = new Dictionary<string, double>(); List<EPObj.MemorySafe_CartCoord> coords = epsurface.SurfaceCoords; //we use a very simple algorithm where we find the area and the max height //we divide the area by the max height, and this is our width. //this helps us cover the case of non-vertical surfaces, and polygons that //are not rectangles double width = 0; double height = 0; for (int i = 0; i < (coords.Count() - 1); i++) { double dx = Math.Abs(coords[i].X - coords[i + 1].X); double dy = Math.Abs(coords[i].Y - coords[i + 1].Y); double dz = Math.Abs(coords[i].Z - coords[i + 1].Z); //get the height if (surftype == surfaceTypeEnum.ExteriorWall || surftype == surfaceTypeEnum.InteriorWall || surftype == surfaceTypeEnum.UndergroundWall) { if (dz == 0) continue; else { if (dx == 0 && dy == 0) { if (dz > height) { height = dz; } else continue; } else { //can you prove this somehow? double dist = Math.Sqrt(Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)) + Math.Pow(dz, 2)); if (dist > height) { height = dist; } else continue; } } } else { if (dz == 0) { double dist = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)); if (dist > height) { height = dist; } else continue; } else //it is tilted { double dist = Math.Sqrt(Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)) + Math.Pow(dz, 2)); if (dist > height) { height = dist; } else continue; } } //this simplifies the definition of width and area greatly double area = EPObj.GetAreaofSurface(epsurface); if (height != 0) { width = area / height; } } WH.Add("width", width); WH.Add("height", height); return WH; }