///<summary> /// Sabine Reverberation Time : T60 = 0.161V/ln(1-a)S ///</summary> public static void Eyring(Environment.Scene Room, double volume, ref double[] T60) { T60 = new double[8]; if (Room == null) return; double TA; for (int t = 0; t <= 7; t++) { TA = 0; for (int q = 0; q <= Room.Count() - 1; q++) { TA += (Room.SurfaceArea(q) * (-System.Math.Log(1 - Room.AbsorptionValue[q].Coefficient_A_Broad(t),System.Math.E))); } T60[t] = 0.161 * volume / (TA + 4 * Room.Attenuation(0)[t] * volume); } }
public VoxelGrid_RC(Environment.RhCommon_Scene ModelSurfaces, List<Point3d> Pts, int VG_Domain) { VoxelCT = VG_Domain; VoxelInventory = new List<int>[VoxelCT, VoxelCT, VoxelCT]; Voxel = new List<Point3d>[VoxelCT, VoxelCT, VoxelCT]; //for (int q = 0; q < ModelSurfaces.Objects.Count; q++) //{ // Surfaces[q] = ModelSurfaces.Objects[q].Object(); //} BoundingBox TightOBox = new BoundingBox(); Point3d BoxMin = new Point3d(); Point3d BoxMax = new Point3d(); foreach (Point3d Pt in Pts) { TightOBox.Union(Pt); } foreach (Brep B in ModelSurfaces.Breps()) { TightOBox.Union(B.GetBoundingBox(true)); } OverallBBox = new BoundingBox(new Point3d(TightOBox.Min.X - 1, TightOBox.Min.Y - 1, TightOBox.Min.Z - 1), new Point3d(TightOBox.Max.X + 1, TightOBox.Max.Y + 1, TightOBox.Max.Z + 1)); this.X_Incr = (OverallBBox.Max.X - OverallBBox.Min.X) / VoxelCT; this.Y_Incr = (OverallBBox.Max.Y - OverallBBox.Min.Y) / VoxelCT; this.Z_Incr = (OverallBBox.Max.Z - OverallBBox.Min.Z) / VoxelCT; double X_2 = X_Incr/2; double Y_2 = Y_Incr/2; double Z_2 = Z_Incr/2; Radius2 = X_2*X_2 + Y_2*Y_2 + Z_2*Z_2; //For((int XBox = 0; XBox < VoxelCT; XBox++) Parallel.For(0, VoxelCT, XBox => { Rhino.RhinoApp.SetCommandPrompt(string.Format("Voxelizing: {0}%", Math.Round((double)XBox / VoxelCT - 1, 2) * 100)); for (int YBox = 0; YBox < VoxelCT; YBox++) { for (int ZBox = 0; ZBox < VoxelCT; ZBox++) { BoxMin = new Point3d((OverallBBox.Min.X + this.X_Incr * XBox) - X_Incr / 10, (OverallBBox.Min.Y + this.Y_Incr * YBox) - Y_Incr / 10, (OverallBBox.Min.Z + this.Z_Incr * ZBox) - Z_Incr / 10); BoxMax = new Point3d((OverallBBox.Min.X + this.X_Incr * (XBox + 1)) + X_Incr / 10, (OverallBBox.Min.Y + this.Y_Incr * (YBox + 1)) + Y_Incr / 10, (OverallBBox.Min.Z + this.Z_Incr * (ZBox + 1)) + X_Incr / 10); this.Voxel[XBox, YBox, ZBox] = new List<Point3d>(); this.Voxel[XBox, YBox, ZBox].Add(BoxMin); this.Voxel[XBox, YBox, ZBox].Add(BoxMax); this.VoxelInventory[XBox, YBox, ZBox] = new List<int>(); for (int Index = 0; Index < ModelSurfaces.Count(); Index++) { BoundingBox TestBox = new BoundingBox(); TestBox = new BoundingBox(this.Voxel[XBox, YBox, ZBox][0], this.Voxel[XBox, YBox, ZBox][1]); if (BoxIntersection(ModelSurfaces, TestBox, Index)) { this.VoxelInventory[XBox, YBox, ZBox].Add(Index); } } } } }); }
///<summary> /// Sabine Reverberation Time : T60 = 0.161V/A ///</summary> public static void Sabine(Environment.Scene Room, double volume, ref double[] T60) { T60 = new double[8]; if (Room == null) return; double TA; for (int t = 0; t <= 7; t++) { TA = 0; for (int q = 0; q <= Room.Count() - 1; q++) { TA += (Room.SurfaceArea(q) * Room.AbsorptionValue[q].Coefficient_A_Broad(t)); } T60[t] = (0.161 * (volume / (TA + (4 * Room.Attenuation(0)[t] * volume)))); } }