NPlot.LogAxis.PhysicalToWorld C# (CSharp) Method

PhysicalToWorld() public method

Return the world coordinate of the projection of the point p onto the axis.
public PhysicalToWorld ( PointF p, PointF physicalMin, PointF physicalMax, bool clip ) : double
p System.Drawing.PointF The point to project onto the axis
physicalMin System.Drawing.PointF The physical position corresponding to the world minimum of the axis.
physicalMax System.Drawing.PointF The physical position corresponding to the world maximum of the axis.
clip bool If true, the world value will be clipped to WorldMin or WorldMax as appropriate if it lies outside this range.
return double
        public override double PhysicalToWorld( PointF p, PointF physicalMin, PointF physicalMax, bool clip )
        {
            // use the base method to do the projection on the axis.
            double t = base.PhysicalToWorld( p, physicalMin, physicalMax, clip );

            // now reconstruct phys dist prop along this assuming linear scale as base method did.
            double v = (t - this.WorldMin) / (this.WorldMax - this.WorldMin);

            double ret = WorldMin*Math.Pow( WorldMax / WorldMin, v );

            // if want clipped value, return extrema if outside range.
            if (clip)
            {
                ret = Math.Max( ret, WorldMin );
                ret = Math.Min( ret, WorldMax );
            }

            return ret;
        }