private void FillInertiaTensor(Simple3D.Matrix3d matrix) { var matrixValues = matrix.ToArray(); string matrixStr = string.Join("; ", matrixValues); InertiaTensorTextBox.Text = matrixStr; }
private void InertiaTensorTextBox_Validated(object sender, EventArgs e) { if (CurrentProject == null) { return; } var matValues = InertiaTensorTextBox.Text.Split(';'); if (matValues.Length == 9) { var inertiaMatrix = new Simple3D.Matrix3d(); bool validValues = true; for (int i = 0; i < 9; i++) { if (NumberHelper.SmartTryParse(matValues[i], out double cellValue)) { inertiaMatrix[i] = cellValue; } else { validValues = false; break; } } if (validValues) { CurrentProject.PhysicsAttributes.InertiaTensor = inertiaMatrix; } else { FillInertiaTensor(CurrentProject.PhysicsAttributes.InertiaTensor); } } }