private void Color_Selection_SelectedIndexChanged(object sender, EventArgs e)
            {
                switch (this.Color_Selection.Text)
                {
                case "R-O-Y-G-B-I-V":
                    scale             = new Pach_Graphics.HSV_colorscale(Param_Scale.Height, Param_Scale.Width, 0, 4.0 / 3.0, 1, 0, 1, 1, false, 12);
                    Param_Scale.Image = scale.PIC;
                    break;

                case "Y-G-B":
                    scale             = new Pach_Graphics.HSV_colorscale(Param_Scale.Height, Param_Scale.Width, Math.PI / 3.0, 2.0 / 3.0, 1, 0, 1, 0, false, 12);
                    Param_Scale.Image = scale.PIC;
                    break;

                case "R-O-Y":
                    scale             = new Pach_Graphics.HSV_colorscale(Param_Scale.Height, Param_Scale.Width, 0, 1.0 / 3.0, 1, 0, 1, 0, false, 12);
                    Param_Scale.Image = scale.PIC;
                    break;

                case "W-B":
                    scale             = new Pach_Graphics.HSV_colorscale(Param_Scale.Height, Param_Scale.Width, 0, 0, 0, 0, 1, -1, false, 12);
                    Param_Scale.Image = scale.PIC;
                    break;

                case "R-M-B":
                    scale             = new Pach_Graphics.HSV_colorscale(Param_Scale.Height, Param_Scale.Width, 0, 0, 1, 0, 1, -1, false, 12);
                    Param_Scale.Image = scale.PIC;
                    break;

                default:
                    scale             = new Pach_Graphics.HSV_colorscale(Param_Scale.Height, Param_Scale.Width, 0, Math.PI / 2.0, 0, 0, 1, 1, false, 12);
                    Param_Scale.Image = scale.PIC;
                    break;
                }
                if (PreviewDisplay != null)
                {
                    PreviewDisplay.SetColorScale(scale, new double[] { (double)Param_Min.Value, (double)Param_Max.Value });
                }
            }
            private void Calculate_Click(object sender, System.EventArgs e)
            {
                FC = new ForCall(Forw_proc);

                Polygon_Scene Rm = RC_PachTools.Get_Poly_Scene((double)Rel_Humidity.Value, false, (double)Air_Temp.Value, (double)Air_Pressure.Value, Atten_Method.SelectedIndex, EdgeFreq.Checked);

                if (!Rm.Complete)
                {
                    return;
                }

                if (P == null)
                {
                    P = new WaveConduit(scale, new double[2] {
                        (double)this.Param_Min.Value, (double)this.Param_Max.Value
                    });
                }
                Hare.Geometry.Point[] Src = RC_PachTools.GetSource();
                Hare.Geometry.Point[] Rec = new Hare.Geometry.Point[0];//PachTools.GetReceivers().ToArray();
                if (Src.Length < 1 || Rm == null)
                {
                    Rhino.RhinoApp.WriteLine("Model geometry not specified... Exiting calculation...");
                }

                Numeric.TimeDomain.Signal_Driver_Compact.Signal_Type s_type = Numeric.TimeDomain.Signal_Driver_Compact.Signal_Type.Dirac_Pulse;

                switch (SourceSelect.Text)
                {
                case "Dirac Pulse":
                    s_type = Numeric.TimeDomain.Signal_Driver_Compact.Signal_Type.Dirac_Pulse;
                    break;

                case "Sine Wave":
                    s_type = Numeric.TimeDomain.Signal_Driver_Compact.Signal_Type.Sine_Tone;
                    break;

                case "Sine Pulse":
                    s_type = Numeric.TimeDomain.Signal_Driver_Compact.Signal_Type.Sine_Pulse;
                    break;
                }

                Numeric.TimeDomain.Signal_Driver_Compact SD  = new Numeric.TimeDomain.Signal_Driver_Compact(s_type, (double)Frequency_Selection.Value, 1, RC_PachTools.GetSource());
                Numeric.TimeDomain.Microphone_Compact    Mic = new Numeric.TimeDomain.Microphone_Compact(Rec);

                FDTD = new Numeric.TimeDomain.Acoustic_Compact_FDTD_RC(Rm, ref SD, ref Mic, (double)Freq_Max.Value, (double)CO_TIME.Value, Numeric.TimeDomain.Acoustic_Compact_FDTD.GridType.Freefield, null, 0, 0, 0);
                //FDTD = new Numeric.TimeDomain.Acoustic_Compact_FDTD(Rm, ref SD, ref Mic, (double)Freq_Max.Value, (double)CO_TIME.Value, Numeric.TimeDomain.Acoustic_Compact_FDTD.GridType.ScatteringLab, new Hare.Geometry.Point(0,0,0), 8, 6, 5);
                M = new Rhino.Geometry.Mesh[3][] { FDTD.m_templateX, FDTD.m_templateY, FDTD.m_templateZ };

                P.SetColorScale(new Pach_Graphics.HSV_colorscale(Param_Scale.Height, Param_Scale.Width, 0, 4.0 / 3.0, 1, 0, 1, 1, false, 12), new double[] { (double)Param_Min.Value, (double)Param_Max.Value });
                P.Enabled = true;

                if (AxisSelect.SelectedIndex == 0)
                {
                    Pos_Select.Maximum = FDTD.xDim - 1;
                }
                else if (AxisSelect.SelectedIndex == 1)
                {
                    Pos_Select.Maximum = FDTD.yDim - 1;
                }
                else if (AxisSelect.SelectedIndex == 2)
                {
                    Pos_Select.Maximum = FDTD.zDim - 1;
                }

                if (Map_Planes.Items.Count == 0)
                {
                    Pos_Select.Value = Pos_Select.Maximum / 2;
                    AddPlane_Click(new object(), new EventArgs());
                }

                Loop_Click(new object(), new EventArgs());
            }
示例#3
0
            private void Commit_Param_Bounds()
            {
                switch (Parameter_Selection.Text)
                {
                case "Sound Pressure Level":
                    Current_SPLMin     = (double)this.Param_Min.Value;
                    Current_SPLMax     = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_SPLMax - Current_SPLMin) * .25) + Current_SPLMin).ToString();
                    this.Param1_2.Text = (((Current_SPLMax - Current_SPLMin) * .5) + Current_SPLMin).ToString();
                    this.Param3_4.Text = (((Current_SPLMax - Current_SPLMin) * .75) + Current_SPLMin).ToString();
                    break;

                case "Sound Pressure Level (A-weighted)":
                    Current_SPLAMin    = (double)this.Param_Min.Value;
                    Current_SPLAMax    = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_SPLAMax - Current_SPLAMin) * .25) + Current_SPLAMin).ToString();
                    this.Param1_2.Text = (((Current_SPLAMax - Current_SPLAMin) * .5) + Current_SPLAMin).ToString();
                    this.Param3_4.Text = (((Current_SPLAMax - Current_SPLAMin) * .75) + Current_SPLAMin).ToString();
                    break;

                case "Early Decay Time (T-15)":
                    Current_EDTMin     = (double)this.Param_Min.Value;
                    Current_EDTMax     = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_EDTMax - Current_EDTMin) * .25) + Current_EDTMin).ToString();
                    this.Param1_2.Text = (((Current_EDTMax - Current_EDTMin) * .5) + Current_EDTMin).ToString();
                    this.Param3_4.Text = (((Current_EDTMax - Current_EDTMin) * .75) + Current_EDTMin).ToString();
                    break;

                case "Reverberation Time (T-15)":
                    Current_RTMin      = (double)this.Param_Min.Value;
                    Current_RTMax      = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_RTMax - Current_RTMin) * .25) + Current_RTMin).ToString();
                    this.Param1_2.Text = (((Current_RTMax - Current_RTMin) * .5) + Current_RTMin).ToString();
                    this.Param3_4.Text = (((Current_RTMax - Current_RTMin) * .75) + Current_RTMin).ToString();
                    break;

                case "Reverberation Time (T-30)":
                    Current_RTMin      = (double)this.Param_Min.Value;
                    Current_RTMax      = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_RTMax - Current_RTMin) * .25) + Current_RTMin).ToString();
                    this.Param1_2.Text = (((Current_RTMax - Current_RTMin) * .5) + Current_RTMin).ToString();
                    this.Param3_4.Text = (((Current_RTMax - Current_RTMin) * .75) + Current_RTMin).ToString();
                    break;

                case "Speech Transmission Index - 2003":
                    Current_STI1Min    = (double)this.Param_Min.Value;
                    Current_STI1Max    = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_STI1Max - Current_STI1Min) * .25) + Current_STI1Min).ToString();
                    this.Param1_2.Text = (((Current_STI1Max - Current_STI1Min) * .5) + Current_STI1Min).ToString();
                    this.Param3_4.Text = (((Current_STI1Max - Current_STI1Min) * .75) + Current_STI1Min).ToString();
                    break;

                case "Speech Transmission Index - Male":
                    Current_STI2Min    = (double)this.Param_Min.Value;
                    Current_STI2Max    = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_STI2Max - Current_STI2Min) * .25) + Current_STI2Min).ToString();
                    this.Param1_2.Text = (((Current_STI2Max - Current_STI2Min) * .5) + Current_STI2Min).ToString();
                    this.Param3_4.Text = (((Current_STI2Max - Current_STI2Min) * .75) + Current_STI2Min).ToString();
                    break;

                case "Speech Transmission Index - Female":
                    Current_STI3Min    = (double)this.Param_Min.Value;
                    Current_STI3Max    = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_STI3Max - Current_STI3Min) * .25) + Current_STI3Min).ToString();
                    this.Param1_2.Text = (((Current_STI3Max - Current_STI3Min) * .5) + Current_STI3Min).ToString();
                    this.Param3_4.Text = (((Current_STI3Max - Current_STI3Min) * .75) + Current_STI3Min).ToString();
                    break;

                case "Clarity (C-80)":
                    Current_CMin       = (double)this.Param_Min.Value;
                    Current_CMax       = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_CMax - Current_CMin) * .25) + Current_CMin).ToString();
                    this.Param1_2.Text = (((Current_CMax - Current_CMin) * .5) + Current_CMin).ToString();
                    this.Param3_4.Text = (((Current_CMax - Current_CMin) * .75) + Current_CMin).ToString();
                    break;

                case "Definition (D-50)":
                    Current_DMin       = (double)this.Param_Min.Value;
                    Current_DMax       = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_DMax - Current_DMin) * .25) + Current_DMin).ToString();
                    this.Param1_2.Text = (((Current_DMax - Current_DMin) * .5) + Current_DMin).ToString();
                    this.Param3_4.Text = (((Current_DMax - Current_DMin) * .75) + Current_DMin).ToString();
                    break;

                case "Strength/Loudness (G)":
                    Current_GMin       = (double)this.Param_Min.Value;
                    Current_GMax       = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_GMax - Current_GMin) * .25) + Current_GMin).ToString();
                    this.Param1_2.Text = (((Current_GMax - Current_GMin) * .5) + Current_GMin).ToString();
                    this.Param3_4.Text = (((Current_GMax - Current_GMin) * .75) + Current_GMin).ToString();
                    break;

                case "Percent who perceive echoes (EK)":
                    Current_EMin       = (double)this.Param_Min.Value;
                    Current_EMax       = (double)this.Param_Max.Value;
                    this.Param1_4.Text = (((Current_EMax - Current_EMin) * .25) + Current_GMin).ToString();
                    this.Param1_2.Text = (((Current_EMax - Current_EMin) * .5) + Current_GMin).ToString();
                    this.Param3_4.Text = (((Current_EMax - Current_EMin) * .75) + Current_GMin).ToString();
                    break;

                default:
                    Rhino.RhinoApp.WriteLine("Whoops... Parameter selection invalid...");
                    break;
                }

                if (WC != null)
                {
                    WC.SetColorScale(c_scale, new double[2] {
                        (double)Param_Min.Value, (double)Param_Max.Value
                    });
                }
            }