C# Class NPlot.Utils

General purpose utility functions used internally.
Show file Open project: GridProtectionAlliance/openHistorian

Public Methods

Method Description
ArrayMinMax ( IList a, double &min, double &max ) : bool

Returns the minimum and maximum values in an IList. The members of the list can be of different types - any type for which the function Utils.ConvertToDouble knows how to convert into a double.

Distance ( PointF a, PointF b ) : float

Calculate the distance between two points, a and b.

Distance ( Point a, Point b ) : int

Calculate the distance between two points, a and b.

DoubleEqual ( double a, double b ) : bool

Returns true if the absolute difference between parameters is less than Epsilon

ScaleFont ( Font initial, double scale ) : Font

Get a Font exactly the same as the passed in one, except for scale factor.

Swap ( double &a, double &b ) : void

Swaps the value of two doubles.

UnitVector ( PointF a, PointF b ) : PointF

Returns unit vector along the line a->b.

Method Details

ArrayMinMax() public static method

Returns the minimum and maximum values in an IList. The members of the list can be of different types - any type for which the function Utils.ConvertToDouble knows how to convert into a double.
public static ArrayMinMax ( IList a, double &min, double &max ) : bool
a IList The IList to search.
min double The minimum value.
max double The maximum value.
return bool

Distance() public static method

Calculate the distance between two points, a and b.
public static Distance ( PointF a, PointF b ) : float
a System.Drawing.PointF First point
b System.Drawing.PointF Second point
return float

Distance() public static method

Calculate the distance between two points, a and b.
public static Distance ( Point a, Point b ) : int
a Point First point
b Point Second point
return int

DoubleEqual() public static method

Returns true if the absolute difference between parameters is less than Epsilon
public static DoubleEqual ( double a, double b ) : bool
a double first number to compare
b double second number to compare
return bool

ScaleFont() public static method

Get a Font exactly the same as the passed in one, except for scale factor.
public static ScaleFont ( Font initial, double scale ) : Font
initial System.Drawing.Font The font to scale.
scale double Scale by this factor.
return System.Drawing.Font

Swap() public static method

Swaps the value of two doubles.
public static Swap ( double &a, double &b ) : void
a double first value to swap.
b double second value to swap.
return void

UnitVector() public static method

Returns unit vector along the line a->b.
public static UnitVector ( PointF a, PointF b ) : PointF
a System.Drawing.PointF line start point.
b System.Drawing.PointF line end point.
return System.Drawing.PointF