// This call is required by the Windows Form Designer. public Pach_TD_Numeric_Control() { InitializeComponent(); Selected_Extent.SelectedIndex = 4; 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; }
// This call is required by the Windows Form Designer. public Pach_TD_Numeric_Control() { InitializeComponent(); Selected_Extent.SelectedIndex = 4; 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; }
// This call is required by the Windows Form Designer. public Pach_Visual_Control() { InitializeComponent(); 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; }
/// <summary> /// Creates color map mesh from user defined parameters and a data set. /// </summary> /// <param name="mesh">the mesh to use for parameter mapping.</param> /// <param name="scale_enum">an integer indicating which color scale to use.</param> /// <param name="Values">the list of values calculated for each point.</param> /// <param name="LBound">the lower bound of the scale.</param> /// <param name="UBound">the upper bound of the scale.</param> /// <returns>the colored map.</returns> public static string CreateMap(Mesh mesh, int scale_enum, double[] Values, double LBound, double UBound) { double H_OFFSET; double H_BREADTH; double S_OFFSET; double S_BREADTH; double V_OFFSET; double V_BREADTH; if (Values.Length != mesh.Vertices.Count) { return(System.Guid.Empty.ToString()); } Pach_Graphics.HSV_colorscale c_scale; System.Drawing.Color[] Colors; switch (scale_enum) { case 0: H_OFFSET = 0; H_BREADTH = 4.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 24); break; case 1: Colors = new System.Drawing.Color[2]; H_OFFSET = 0; H_BREADTH = 1.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; case 2: Colors = new System.Drawing.Color[2]; H_OFFSET = Math.PI / 3.0; H_BREADTH = 1.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; case 3: Colors = new System.Drawing.Color[2]; H_OFFSET = 0; H_BREADTH = -2.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; case 4: H_OFFSET = 0; H_BREADTH = 0; S_OFFSET = 0; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = -1; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; default: Rhino.RhinoApp.WriteLine("Whoops... Color selection invalid... Most obnoxious color imaginable substituted!"); Colors = new System.Drawing.Color[2]; H_OFFSET = 2.0 * Math.PI / 3; H_BREADTH = 0; S_OFFSET = 1; S_BREADTH = -1; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; } double Scale_Breadth = UBound - LBound; for (int i = 0; i < Values.Length; i++) { System.Drawing.Color color = c_scale.GetValue(Values[i], LBound, UBound); mesh.VertexColors.SetColor(i, color); } return(Rhino.RhinoDoc.ActiveDoc.Objects.AddMesh(mesh).ToString()); }
/// <summary> /// Creates color map mesh from user defined parameters and a data set. /// </summary> /// <param name="mesh">the mesh to use for parameter mapping.</param> /// <param name="scale_enum">an integer indicating which color scale to use.</param> /// <param name="Values">the list of values calculated for each point.</param> /// <param name="LBound">the lower bound of the scale.</param> /// <param name="UBound">the upper bound of the scale.</param> /// <returns>the colored map.</returns> public static string CreateMap(Mesh mesh, int scale_enum, double[] Values, double LBound, double UBound) { double H_OFFSET; double H_BREADTH; double S_OFFSET; double S_BREADTH; double V_OFFSET; double V_BREADTH; if (Values.Length != mesh.Vertices.Count) return System.Guid.Empty.ToString(); Pach_Graphics.HSV_colorscale c_scale; System.Drawing.Color[] Colors; switch (scale_enum) { case 0: H_OFFSET = 0; H_BREADTH = 4.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1,1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 24); break; case 1: Colors = new System.Drawing.Color[2]; H_OFFSET = 0; H_BREADTH = 1.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; case 2: Colors = new System.Drawing.Color[2]; H_OFFSET = Math.PI / 3.0; H_BREADTH = 1.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; case 3: Colors = new System.Drawing.Color[2]; H_OFFSET = 0; H_BREADTH = -2.0 / 3.0; S_OFFSET = 1; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; case 4: H_OFFSET = 0; H_BREADTH = 0; S_OFFSET = 0; S_BREADTH = 0; V_OFFSET = 1; V_BREADTH = -1; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; default: Rhino.RhinoApp.WriteLine("Whoops... Color selection invalid... Most obnoxious color imaginable substituted!"); Colors = new System.Drawing.Color[2]; H_OFFSET = 2.0 * Math.PI / 3; H_BREADTH = 0; S_OFFSET = 1; S_BREADTH = -1; V_OFFSET = 1; V_BREADTH = 0; c_scale = new Pach_Graphics.HSV_colorscale(1, 1, H_OFFSET, H_BREADTH, S_OFFSET, S_BREADTH, V_OFFSET, V_BREADTH, false, 12); break; } double Scale_Breadth = UBound - LBound; for (int i = 0; i < Values.Length; i++) { System.Drawing.Color color = c_scale.GetValue(Values[i], LBound, UBound); mesh.VertexColors.SetColor(i, color); } return Rhino.RhinoDoc.ActiveDoc.Objects.AddMesh(mesh).ToString(); }
// This call is required by the Windows Form Designer. public Pach_Visual_Control() { InitializeComponent(); 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; }