Struct Interval
Defines an interval.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
[Serializable]
public struct Interval
Constructors
Interval(double, double)
Initializes a new instance of the Interval class. If max
smaller
than min
, it is set to the value of min
instead.
Declaration
public Interval(double min, double max)
Parameters
Type | Name | Description |
---|---|---|
double | min | The start of the interval. |
double | max | The end of the interval. |
Fields
Max
The maximum value of the interval. This value is greater than or equal to Min when this struct was initialized using its constructor.
Declaration
[FormerlySerializedAs("max")]
public double Max
Field Value
Type | Description |
---|---|
double |
Min
The minimum value of the interval. This value is smaller than or equal to Max when this struct was initialized using its constructor.
Declaration
[FormerlySerializedAs("min")]
public double Min
Field Value
Type | Description |
---|---|
double |
Methods
Contains(Interval)
Checks whether this interval completely contains the specified interval.
Declaration
public bool Contains(Interval other)
Parameters
Type | Name | Description |
---|---|---|
Interval | other | The other interval. |
Returns
Type | Description |
---|---|
bool | Whether this interval completely contains the specified interval. |
Contains(double)
Tests whether this interval contains the specified value.
Declaration
public bool Contains(double value)
Parameters
Type | Name | Description |
---|---|---|
double | value | The value to check for. |
Returns
Type | Description |
---|---|
bool | Whether this interval contains the specified value. |
CreateClamped01(double, double)
Creates a new interval that is clamped to the range of [0, 1].
Declaration
public static Interval CreateClamped01(double min, double max)
Parameters
Type | Name | Description |
---|---|---|
double | min | The start of the interval. |
double | max | The end of the interval. |
Returns
Type | Description |
---|---|
Interval | The interval for the specified range. |
Deconstruct(out double, out double)
Declaration
public void Deconstruct(out double min, out double max)
Parameters
Type | Name | Description |
---|---|---|
double | min | |
double | max |
Equals(Interval)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(Interval other)
Parameters
Type | Name | Description |
---|---|---|
Interval | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
GetBounds(Interval, Interval)
Creates a new intervals, consisting of the boundaries of two given intervals.
Declaration
public static Interval GetBounds(Interval a, Interval b)
Parameters
Type | Name | Description |
---|---|---|
Interval | a | The first interval. |
Interval | b | The second interval. |
Returns
Type | Description |
---|---|
Interval | New interval, consisting of the boundaries of the two given intervals. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
GetRandomValue(Random)
Generates a random value within this interval.
Declaration
public float GetRandomValue(Random random)
Parameters
Type | Name | Description |
---|---|---|
Random | random |
Returns
Type | Description |
---|---|
float |
Lerp(double)
Declaration
public double Lerp(double t)
Parameters
Type | Name | Description |
---|---|---|
double | t | The interpolation between the two points defining this interval. |
Returns
Type | Description |
---|---|
double | The double value as a result from the linear interpolation. |
Lerp(float)
Declaration
public float Lerp(float t)
Parameters
Type | Name | Description |
---|---|---|
float | t | The interpolation between the two points defining this interval. |
Returns
Type | Description |
---|---|
float | The float value as a result from the linear interpolation. |
Overlaps(Interval)
Checks whether this interval and the specified interval overlap.
Declaration
public bool Overlaps(Interval other)
Parameters
Type | Name | Description |
---|---|---|
Interval | other | The other interval. |
Returns
Type | Description |
---|---|
bool | Whether this interval and the specified interval overlap. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
TryIntersect(Interval, Interval, out Interval)
Computes the interval representing the intersect of the specified intervals.
Declaration
public static bool TryIntersect(Interval intervalA, Interval intervalB, out Interval intersection)
Parameters
Type | Name | Description |
---|---|---|
Interval | intervalA | The first interval. |
Interval | intervalB | The second interval. |
Interval | intersection | The intersection of the specified intervals. |
Returns
Type | Description |
---|---|
bool | True if the intervals intersect, false otherwise. |
Operators
operator ==(Interval, Interval)
Declaration
public static bool operator ==(Interval left, Interval right)
Parameters
Type | Name | Description |
---|---|---|
Interval | left | |
Interval | right |
Returns
Type | Description |
---|---|
bool |
implicit operator (double Min, double Max)(Interval)
Declaration
public static implicit operator (double Min, double Max)(Interval interval)
Parameters
Type | Name | Description |
---|---|---|
Interval | interval |
Returns
Type | Description |
---|---|
(double Min, double Max) |
implicit operator Interval((double Min, double Max))
Declaration
public static implicit operator Interval((double Min, double Max) interval)
Parameters
Type | Name | Description |
---|---|---|
(double Min, double Max) | interval |
Returns
Type | Description |
---|---|
Interval |
operator !=(Interval, Interval)
Declaration
public static bool operator !=(Interval left, Interval right)
Parameters
Type | Name | Description |
---|---|---|
Interval | left | |
Interval | right |
Returns
Type | Description |
---|---|
bool |