Struct FloatRange
Represents a double range with minimum and maximum values,
where values are single-precision floating-point (float) numbers.
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Mars.Numerics.Ranges
Assembly: Mars.Numerics.dll
Syntax
[Serializable]
public struct FloatRange : IRange<float>, IFormattable, IEquatable<FloatRange>
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
Examples
// create [0.25, 1.5] range
var range1 = new SingleRange(0.25f, 1.5f);
// create [1.00, 2.25] range
var range2 = new SingleRange(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))
{
// ...
}
Constructors
| Improve this Doc View SourceFloatRange(Single, Single)
Initializes a new instance of the FloatRange class.
Declaration
public FloatRange(float min, float max)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | min | Minimum value of the range. |
| System.Single | max | Maximum value of the range. |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
Properties
| Improve this Doc View SourceLength
Gets the length of the range, defined as (max - min).
Declaration
public readonly float Length { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceMax
Maximum value of the range.
Declaration
public float Max { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Represents maximum value (right side limit) of the range [min, max].
See Also
| Improve this Doc View SourceMin
Minimum value of the range.
Declaration
public float Min { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Represents minimum value (left side limit) of the range [min, max].
See Also
Methods
| Improve this Doc View SourceEquals(FloatRange)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(FloatRange other)
Parameters
| Type | Name | Description |
|---|---|---|
| FloatRange | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
true if the current object is equal to the other parameter; otherwise, false.
|
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceEquals(Object)
Determines whether the specified System.Object, is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The System.Object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
true if the specified System.Object is equal to this instance; otherwise, false.
|
Overrides
System.ValueType.Equals(System.Object)
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceGetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
System.ValueType.GetHashCode()
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceIntersection(FloatRange)
Computes the intersection between two ranges.
Declaration
public FloatRange Intersection(FloatRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| FloatRange | range | The second range for which the intersection should be calculated. |
Returns
| Type | Description |
|---|---|
| FloatRange |
An new FloatRange structure containing the intersection
between this range and the range given as argument.
|
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceIsInside(FloatRange)
Check if the specified range is inside of the range.
Declaration
public bool IsInside(FloatRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| FloatRange | range | Range to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the specified range is inside of the range or false otherwise. |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceIsInside(Single)
Check if the specified value is inside of the range.
Declaration
public bool IsInside(float x)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | Value to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the specified value is inside of the range or false otherwise. |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceIsOverlapping(FloatRange)
Check if the specified range overlaps with the range.
Declaration
public bool IsOverlapping(FloatRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| FloatRange | range | Range to check for overlapping. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the specified range overlaps with the range or false otherwise. |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceToIntRange(Boolean)
Converts this single-precision range into an IntRange.
Declaration
public IntRange ToIntRange(bool provideInnerRange)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | provideInnerRange | Specifies if inner integer range must be returned or outer range. |
Returns
| Type | Description |
|---|---|
| IntRange | Returns integer version of the range. |
Remarks
If
provideInnerRange is set to true, then the
returned integer range will always fit inside of the current single precision range.
If it is set to false, then current single precision range will always
fit into the returned integer range.
See Also
| Improve this Doc View SourceToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
Overrides
System.ValueType.ToString()
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceToString(String, IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | format | The format. |
| System.IFormatProvider | formatProvider | The format provider. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
Operators
| Improve this Doc View SourceEquality(FloatRange, FloatRange)
Determines whether two instances are equal.
Declaration
public static bool operator ==(FloatRange range1, FloatRange range2)
Parameters
| Type | Name | Description |
|---|---|---|
| FloatRange | range1 | |
| FloatRange | range2 |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceImplicit(FloatRange to DoubleRange)
Performs an implicit conversion from IntRange to DoubleRange.
Declaration
public static implicit operator DoubleRange(FloatRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| FloatRange | range | The range. |
Returns
| Type | Description |
|---|---|
| DoubleRange | The result of the conversion. |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
| Improve this Doc View SourceInequality(FloatRange, FloatRange)
Determines whether two instances are not equal.
Declaration
public static bool operator !=(FloatRange range1, FloatRange range2)
Parameters
| Type | Name | Description |
|---|---|---|
| FloatRange | range1 | |
| FloatRange | range2 |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Remarks
This class represents a double range with inclusive limits, where
both minimum and maximum values of the range are included into it.
Mathematical notation of such range is [min, max].
See Also
Implements
System.IFormattable
System.IEquatable<T>