NPlot.PageAlignedPhysicalAxis.WorldToPhysicalClipped C# (CSharp) Метод

WorldToPhysicalClipped() публичный Метод

return the physical coordinate corresponding to the supplied world coordinate, clipped if it is outside the bounds of the axis
public WorldToPhysicalClipped ( double world ) : float
world double world coordinate to determine physical coordinate for.
Результат float
        public float WorldToPhysicalClipped( double world )
        {
            if (world > worldMax_)
            {
                return pMax_;
            }

            if (world < worldMin_)
            {
                return pMin_;
            }

            // is this quicker than returning WorldToPhysical?
            return (float)(((world-worldMin_) / worldLength_) * (float)pLength_ + (float)pMin_);
        }

Usage Example

Пример #1
0
 /// <summary>
 /// Transforms the given world point to physical coordinates
 /// </summary>
 /// <param name="x">x coordinate of world point to transform.</param>
 /// <param name="y">y coordinate of world point to transform.</param>
 /// <returns>the corresponding physical point.</returns>
 public PointF Transform(double x, double y)
 {
     return(new PointF(
                xAxis_.WorldToPhysicalClipped(x),
                yAxis_.WorldToPhysicalClipped(y)));
 }