private void Timer_Tick(object sender, EventArgs e) { try { if (_field == null) { _timer.IsEnabled = false; return; } if (_isLeftDown || _isRightDown) { #region Dragging mouse double radius = trkBrushSize.Value * .5d; int[] clickFieldPoints = GetFieldSphere(_mousePointHistory[_mousePointHistory.Count - 1], radius, _field); Vector3D dragVelocity = (GetDragVelocity() ?? new Vector3D(0, 0, 0)) * trkVelocityMultiplier.Value; bool applyVelocity = _isRightDown || (_isLeftDown && chkVelocityOnLeftDrag.IsChecked.Value); foreach (int point in clickFieldPoints) { if (_isLeftDown) { // Add color _field.SetInk(point, 1); } if (applyVelocity) { // Add velocity _field.AddVelocity(point, dragVelocity.X, dragVelocity.Y, dragVelocity.Z); } } #endregion } _field.Update(); DrawField(_bitmap, _field, _viewDirection, _colorZFront, _colorZBack); if (_velocityVisualizerWindow != null) { _velocityVisualizerWindow.Update(); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }