private void Redraw_Tick(object sender, EventArgs e) { GList = new List <Int32>(); GList.Add(0); if (MostrarSolicita.Checked) { foreach (Dot dot in dots) { GL.NewList(GList.Count, ListMode.Compile); GL.PointSize(5); GL.Begin(BeginMode.Points); GL.Color3(dot.color); decimal[] aux_dot = FactoryMatrix.xVxM(dot.matrix, dot.dot); GL.Vertex3(Decimal.ToDouble(aux_dot[0]), Decimal.ToDouble(aux_dot[1]), Decimal.ToDouble(aux_dot[2])); GL.End(); GL.EndList(); GList.Add(GList.Count); } } foreach (Line line in lines) { decimal[] from = FactoryMatrix.xVxM(line.matrix, line.from); decimal[] to = FactoryMatrix.xVxM(line.matrix, line.to); GL.NewList(GList.Count, ListMode.Compile); GL.Begin(BeginMode.Lines); GL.LineWidth(line.width); GL.Color3(line.color); GL.Vertex3(Decimal.ToDouble(from[0]), Decimal.ToDouble(from[1]), Decimal.ToDouble(from[2])); GL.Vertex3(Decimal.ToDouble(to[0]), Decimal.ToDouble(to[1]), Decimal.ToDouble(to[2])); GL.End(); GL.EndList(); GList.Add(GList.Count); } Gl_Paint(gl, null); }
private Matrix ScanMatrix(string text) { uint rows = 0, cols = 0; foreach (var row in Regex.Split(text, "\r\n|\r|\n")) { if (row != "") { cols = 0; foreach (var col in row.Trim().Split(' ')) { cols++; } rows++; } } Matrix m = FactoryMatrix.CreateMatrix(rows, cols); rows = 0; foreach (var row in Regex.Split(text, "\r\n|\r|\n")) { if (row != "") { cols = 0; foreach (var col in row.Trim().Split(' ')) { if (double.TryParse(col, out m[rows][cols++]) == false) { throw new ArgumentException(); } } rows++; } } return(m); }