Struct Interval
Structure for a closed 1-dimensional ℝ-interval
Implements
Inherited Members
Namespace: NetTopologySuite.DataStructures
Assembly: NetTopologySuite.dll
Syntax
[Serializable]
public struct Interval : IEquatable<Interval>
Fields
| Edit this page View SourceMax
The upper bound of the interval
Declaration
public double Max
Field Value
| Type | Description |
|---|---|
| double |
Min
The lower bound of the interval
Declaration
public readonly double Min
Field Value
| Type | Description |
|---|---|
| double |
Properties
| Edit this page View SourceCentre
Gets a value indicating the centre of the interval (Min + Width * 0.5)
Declaration
public double Centre { get; }
Property Value
| Type | Description |
|---|---|
| double |
Width
Gets a value indicating the width of the Interval
Declaration
public double Width { get; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
| Edit this page View SourceContains(Interval)
Function to test if this Interval contains interval.
Declaration
public bool Contains(Interval interval)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | interval | The interval to test |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
This is more rigid than Overlaps(Interval)
Contains(double)
Function to test if this Interval contains the value p.
Declaration
public bool Contains(double p)
Parameters
| Type | Name | Description |
|---|---|---|
| double | p | The value to test |
Returns
| Type | Description |
|---|---|
| bool |
|
Contains(double, double)
Function to test if this Interval contains the interval ℝ[min, max].
Declaration
public bool Contains(double min, double max)
Parameters
| Type | Name | Description |
|---|---|---|
| double | min | The minimum value of the interval |
| double | max | The maximum value of the interval |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
This is more rigid than Overlaps(double, double)
Create()
Creates an empty or uninitialized Interval
Declaration
public static Interval Create()
Returns
| Type | Description |
|---|---|
| Interval | An empty or uninitialized Interval |
Create(Interval)
Declaration
public static Interval Create(Interval interval)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | interval | The template interval |
Returns
| Type | Description |
|---|---|
| Interval | An Interval |
Create(double)
Creates an interval with the range ℝ[value,value]
Declaration
public static Interval Create(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value |
Returns
| Type | Description |
|---|---|
| Interval | An Interval |
Create(double, double)
Creates an interval with the range ℝ[val1,val2].
If necessary, val1 and val2 are exchanged.
Declaration
public static Interval Create(double val1, double val2)
Parameters
| Type | Name | Description |
|---|---|---|
| double | val1 | The minimum value |
| double | val2 | The maximum value |
Returns
| Type | Description |
|---|---|
| Interval | An Interval |
Equals(Interval)
Declaration
public bool Equals(Interval other)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceExpandedByInterval(Interval)
Function to compute an interval that contains this and interval Interval
Declaration
public Interval ExpandedByInterval(Interval interval)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | interval | The interval |
Returns
| Type | Description |
|---|---|
| Interval | An interval |
ExpandedByValue(double)
Method to expand
Declaration
public Interval ExpandedByValue(double p)
Parameters
| Type | Name | Description |
|---|---|---|
| double | p |
Returns
| Type | Description |
|---|---|
| Interval |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
| Edit this page View SourceIntersects(Interval)
Function to test if this Interval intersects the interval other.
Declaration
public bool Intersects(Interval other)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | other |
Returns
| Type | Description |
|---|---|
| bool |
Intersects(double, double)
Function to test if this Interval intersects the interval ℝ[min, max].
Declaration
public bool Intersects(double min, double max)
Parameters
| Type | Name | Description |
|---|---|---|
| double | min | The minimum value of the interval |
| double | max | The maximum value of the interval |
Returns
| Type | Description |
|---|---|
| bool |
|
Overlaps(Interval)
Function to test if this Interval overlaps interval.
Declaration
public bool Overlaps(Interval interval)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | interval | The interval to test |
Returns
| Type | Description |
|---|---|
| bool |
|
Overlaps(double, double)
Function to test if this Interval overlaps the interval ℝ[min, max].
Declaration
public bool Overlaps(double min, double max)
Parameters
| Type | Name | Description |
|---|---|---|
| double | min | The minimum value of the interval |
| double | max | The maximum value of the interval |
Returns
| Type | Description |
|---|---|
| bool |
|
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
| Edit this page View Sourceoperator ==(Interval, Interval)
Equality operator for Intervals
Declaration
public static bool operator ==(Interval lhs, Interval rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | lhs | The left-hand-side Interval |
| Interval | rhs | The right-hand-side Interval |
Returns
| Type | Description |
|---|---|
| bool |
|
operator !=(Interval, Interval)
Inequality operator for Intervals
Declaration
public static bool operator !=(Interval lhs, Interval rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| Interval | lhs | The left-hand-side Interval |
| Interval | rhs | The right-hand-side Interval |
Returns
| Type | Description |
|---|---|
| bool |
|