C# Class AForge.Range

Represents a range with minimum and maximum values, which are single precision numbers (floats).

The class represents a single precision range with inclusive limits - both minimum and maximum values of the range are included into it. Mathematical notation of such range is [min, max].

Sample usage:

// create [0.25, 1.5] range Range range1 = new Range( 0.25f, 1.5f ); // create [1.00, 2.25] range Range range2 = new Range( 1.00f, 2.25f ); // check if values is inside of the first range if ( range1.IsInside( 0.75f ) ) { // ... } // check if the second range is inside of the first range if ( range1.IsInside( range2 ) ) { // ... } // check if two ranges overlap if ( range1.IsOverlapping( range2 ) ) { // ... }
Show file Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
Equals ( object obj ) : bool

Check if this instance of Range equal to the specified one.

GetHashCode ( ) : int

Get hash code for this instance.

IsInside ( Range range ) : bool

Check if the specified range is inside of the range.

IsInside ( float x ) : bool

Check if the specified value is inside of the range.

IsOverlapping ( Range range ) : bool

Check if the specified range overlaps with the range.

Range ( float min, float max ) : System

Initializes a new instance of the Range structure.

ToIntRange ( bool provideInnerRange ) : IntRange

Convert the signle precision range to integer range.

If provideInnerRange is set to , then the returned integer range will always fit inside of the current single precision range. If it is set to , then current single precision range will always fit into the returned integer range.

ToString ( ) : string

Get string representation of the class.

operator ( ) : bool

Equality operator - checks if two ranges have equal min/max values.

Method Details

Equals() public method

Check if this instance of Range equal to the specified one.
public Equals ( object obj ) : bool
obj object Another range to check equalty to.
return bool

GetHashCode() public method

Get hash code for this instance.
public GetHashCode ( ) : int
return int

IsInside() public method

Check if the specified range is inside of the range.
public IsInside ( Range range ) : bool
range Range Range to check.
return bool

IsInside() public method

Check if the specified value is inside of the range.
public IsInside ( float x ) : bool
x float Value to check.
return bool

IsOverlapping() public method

Check if the specified range overlaps with the range.
public IsOverlapping ( Range range ) : bool
range Range Range to check for overlapping.
return bool

Range() public method

Initializes a new instance of the Range structure.
public Range ( float min, float max ) : System
min float Minimum value of the range.
max float Maximum value of the range.
return System

ToIntRange() public method

Convert the signle precision range to integer range.
If provideInnerRange is set to , then the returned integer range will always fit inside of the current single precision range. If it is set to , then current single precision range will always fit into the returned integer range.
public ToIntRange ( bool provideInnerRange ) : IntRange
provideInnerRange bool Specifies if inner integer range must be returned or outer range.
return IntRange

ToString() public method

Get string representation of the class.
public ToString ( ) : string
return string

operator() public static method

Equality operator - checks if two ranges have equal min/max values.
public static operator ( ) : bool
return bool