using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace Microsoft.Research.DynamicDataDisplay
{
///
/// Represents a logarithmic transform of both x- and y-values.
///
public sealed class Log10Transform : DataTransform
{
///
/// Initializes a new instance of the class.
///
public Log10Transform() { }
///
/// Transforms the point in data coordinates to viewport coordinates.
///
/// The point in data coordinates.
///
/// Transformed point in viewport coordinates.
///
public override Point DataToViewport(Point pt)
{
double x = pt.X;
double y = pt.Y;
x = x < 0 ? Double.MinValue : Math.Log10(x);
y = y < 0 ? Double.MinValue : Math.Log10(y);
return new Point(x, y);
}
///
/// Transforms the point in viewport coordinates to data coordinates.
///
/// The point in viewport coordinates.
/// Transformed point in data coordinates.
public override Point ViewportToData(Point pt)
{
return new Point(Math.Pow(10, pt.X), Math.Pow(10, pt.Y));
}
///
/// Gets the data domain of this dataTransform.
///
/// The data domain of this dataTransform.
public override DataRect DataDomain
{
get { return DataDomains.XYPositive; }
}
}
}