NPlot::Utils Class Reference

General purpose utility functions used internally. More...

List of all members.

Static Public Member Functions

static bool DoubleEqual (double a, double b)
 Returns true if the absolute difference between parameters is less than Epsilon.
static void Swap (ref double a, ref double b)
 Swaps the value of two doubles.
static float Distance (PointF a, PointF b)
 Calculate the distance between two points, a and b.
static int Distance (Point a, Point b)
 Calculate the distance between two points, a and b.
static double ToDouble (object o)
 Converts an object of type DateTime or IConvertible to double representation.
static bool ArrayMinMax (IList a, out double min, out double max)
 Returns the minimum and maximum values in an IList.
static bool RowArrayMinMax (DataRowCollection rows, out double min, out double max, string columnName)
 Returns the minimum and maximum values in a DataRowCollection.
static bool DataViewArrayMinMax (DataView data, out double min, out double max, string columnName)
 Returns the minimum and maximum values in a DataView.
static PointF UnitVector (PointF a, PointF b)
 Returns unit vector along the line a->b.
static Font ScaleFont (Font initial, double scale)
 Get a Font exactly the same as the passed in one, except for scale factor.
static System.Drawing.Bitmap TiledImage (System.Drawing.Bitmap image, Size size)
 Creates a bitmap from another that is tiled size times in each direction.

Public Attributes

const double Epsilon = double.Epsilon * 1000.0
 Numbers less than this are considered insignificant.


Detailed Description

General purpose utility functions used internally.

Definition at line 63 of file Utils.cs.


Member Function Documentation

static bool NPlot::Utils::ArrayMinMax IList  a,
out double  min,
out double  max
[inline, static]
 

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.

Parameters:
a The IList to search.
min The minimum value.
max The maximum value.
Returns:
true if min max set, false otherwise (a == null or zero length).

Definition at line 160 of file Utils.cs.

static bool NPlot::Utils::DataViewArrayMinMax DataView  data,
out double  min,
out double  max,
string  columnName
[inline, static]
 

Returns the minimum and maximum values in a DataView.

Parameters:
data The DataView to search.
min The minimum value.
max The maximum value.
columnName The name of the column in the row collection to search over.
Returns:
true is min max set, false otherwise (a = null or zero length).

Definition at line 280 of file Utils.cs.

static int NPlot::Utils::Distance Point  a,
Point  b
[inline, static]
 

Calculate the distance between two points, a and b.

Parameters:
a First point
b Second point
Returns:
Distance between points a and b

Definition at line 120 of file Utils.cs.

static float NPlot::Utils::Distance PointF  a,
PointF  b
[inline, static]
 

Calculate the distance between two points, a and b.

Parameters:
a First point
b Second point
Returns:
Distance between points a and b

Definition at line 108 of file Utils.cs.

static bool NPlot::Utils::DoubleEqual double  a,
double  b
[inline, static]
 

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

Parameters:
a first number to compare
b second number to compare
Returns:
true if equal, false otherwise

Definition at line 79 of file Utils.cs.

References Epsilon.

static bool NPlot::Utils::RowArrayMinMax DataRowCollection  rows,
out double  min,
out double  max,
string  columnName
[inline, static]
 

Returns the minimum and maximum values in a DataRowCollection.

Parameters:
rows The row collection to search.
min The minimum value.
max The maximum value.
columnName The name of the column in the row collection to search over.
Returns:
true is min max set, false otherwise (a = null or zero length).

Definition at line 217 of file Utils.cs.

static Font NPlot::Utils::ScaleFont Font  initial,
double  scale
[inline, static]
 

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

Parameters:
initial The font to scale.
scale Scale by this factor.
Returns:
The scaled font.

Definition at line 344 of file Utils.cs.

static void NPlot::Utils::Swap ref double  a,
ref double  b
[inline, static]
 

Swaps the value of two doubles.

Parameters:
a first value to swap.
b second value to swap.

Definition at line 94 of file Utils.cs.

static System.Drawing.Bitmap NPlot::Utils::TiledImage System.Drawing.Bitmap  image,
Size  size
[inline, static]
 

Creates a bitmap from another that is tiled size times in each direction.

Parameters:
image bitmap to tile
size number of times to tile in each direction.
Returns:
the tiled bitmap.

Definition at line 361 of file Utils.cs.

static double NPlot::Utils::ToDouble object  o  )  [inline, static]
 

Converts an object of type DateTime or IConvertible to double representation.

Mapping is 1:1. Note: the System.Convert.ToDouble method can not convert a boxed DateTime to double. This implementation can - but the "is" check probably makes it much slower.

Compare speed with System.Convert.ToDouble and revise code that calls this if significant speed difference.

Parameters:
o The object to convert to double.
Returns:
double value associated with the object.

Definition at line 135 of file Utils.cs.

static PointF NPlot::Utils::UnitVector PointF  a,
PointF  b
[inline, static]
 

Returns unit vector along the line a->b.

Parameters:
a line start point.
b line end point.
Returns:
The unit vector along the specified line.

Definition at line 325 of file Utils.cs.


Member Data Documentation

const double NPlot::Utils::Epsilon = double.Epsilon * 1000.0
 

Numbers less than this are considered insignificant.

This number is bigger than double.Epsilon.

Definition at line 70 of file Utils.cs.

Referenced by DoubleEqual().


The documentation for this class was generated from the following file:
Generated on Sat Nov 5 01:04:09 2005 for NPlot by  doxygen 1.4.5