using System;
using System.Globalization;
using System.Windows.Data;

namespace SurfacePlot3D.Converters
{
    public class DivideByPositiveConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return 0;
            //if (parameter == null) return 0;
            return System.Convert.ToDouble(value.ToString()) / 2D;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
