private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if (m == null)
            {
                return;
            }

            // contourLines = VisualizationOperations.CalculateContours(m, (int)numericUpDown1.Value, dataIndex, ref contourColors, valueToColorHandler, colorMap1.GetMode());

            //  CalcControusOnEdges();
            //shapes = VisualizationOperations.CalcShapes(m, (int)numericUpDown1.Value, dataIndex, valueToColorHandler, colorMap1.GetMode());
            //MarchingCube(double.Parse(isoValueText.Text));
            //MarchingCubeCount();
            isoTri = VisualizationOperations.CalcIsoSurfaces(m, dataIndex, (int)numericUpDown1.Value, valueToColorHandler, colorMap1.GetMode());
            glControl1.Invalidate();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = textBox1.Text = GetCorrectFileName(openFileDialog1.FileName);
                m = new Mesh(fileName);
                m.Transformation.Translate(0, 0, -200);
                AddItemsToComboBox(m);
                dataIndex = (uint)m.VarToIndex[comboBox1.SelectedItem.ToString()];
                m.GetMinMaxValues(dataIndex, out min, out max);

                colorMap1.setMax((float)max);
                colorMap1.setMin((float)min);

                //contourLines = VisualizationOperations.CalculateContours(m, (int)numericUpDown1.Value, dataIndex, ref contourColors, valueToColorHandler, colorMap1.GetMode());
                //CalcControusOnEdges();
                firstTimeDrawingContours = true;
                // shapes = VisualizationOperations.CalcShapes(m, (int)numericUpDown1.Value, dataIndex, valueToColorHandler, colorMap1.GetMode());
                isoTri = VisualizationOperations.CalcIsoSurface(m, dataIndex, double.Parse(isoValueText.Text), valueToColorHandler, colorMap1.GetMode());
                // MarchingCube(double.Parse(isoValueText.Text));
                glControl1.Invalidate();
            }
        }