public WorldToPhysical ( double coord, |
||
coord | double | The coordinate value to transform. |
physicalMin | The physical position corresponding to the world minimum of the axis. | |
physicalMax | The physical position corresponding to the world maximum of the axis. | |
clip | bool | if false, then physical value may extend outside worldMin / worldMax. If true, the physical value returned will be clipped to physicalMin or physicalMax if it lies outside this range. |
리턴 |
public override PointF WorldToPhysical(
double coord,
PointF physicalMin,
PointF physicalMax,
bool clip)
{
// if want clipped value, return extrema if outside range.
if (clip)
{
if (coord > WorldMax)
{
return physicalMax;
}
if (coord < WorldMin)
{
return physicalMin;
}
}
if (coord < 0.0f)
{
throw new NPlotException( "Cannot have negative values for data using Log Axis" );
}
// inside range or don't want to clip.
double lrange = (double)(Math.Log10(WorldMax) - Math.Log10(WorldMin));
double prop = (double)((Math.Log10(coord) - Math.Log10(WorldMin)) / lrange);
PointF offset = new PointF( (float)(prop * (physicalMax.X - physicalMin.X)),
(float)(prop * (physicalMax.Y - physicalMin.Y)) );
return new PointF( physicalMin.X + offset.X, physicalMin.Y + offset.Y );
}