Gorgon
Show / Hide Table of Contents

Struct GorgonRangeD

A type that represents a range between two double values.

Implements
IGorgonEquatableByRef<GorgonRangeD>
IEquatable<GorgonRangeD>
IComparable<GorgonRangeD>
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
Namespace: Gorgon.Core
Assembly: Gorgon.Core.dll
Syntax
public readonly struct GorgonRangeD : IGorgonEquatableByRef<GorgonRangeD>, IEquatable<GorgonRangeD>, IComparable<GorgonRangeD>
Remarks

This a means to determine the range between a minimum double value and a maximum double value. Use this object to determine if a value falls within a specific range of values.

Constructors

| Edit this page View Source

GorgonRangeD(GorgonRangeD)

Initializes a new instance of the GorgonRangeD struct.

Declaration
public GorgonRangeD(GorgonRangeD minMax)
Parameters
Type Name Description
GorgonRangeD minMax

The min max value to copy.

| Edit this page View Source

GorgonRangeD(double, double)

Initializes a new instance of the GorgonRangeD struct.

Declaration
public GorgonRangeD(double min, double max)
Parameters
Type Name Description
double min

The minimum value.

double max

The maximum value.

Fields

| Edit this page View Source

Empty

An empty range value.

Declaration
public static readonly GorgonRangeD Empty
Field Value
Type Description
GorgonRangeD
| Edit this page View Source

Maximum

The maximum value in the range.

Declaration
public readonly double Maximum
Field Value
Type Description
double
| Edit this page View Source

Minimum

The minimum value in the range.

Declaration
public readonly double Minimum
Field Value
Type Description
double

Properties

| Edit this page View Source

IsEmpty

Property to return whether the range is empty or not.

Declaration
[JsonIgnore]
public bool IsEmpty { get; }
Property Value
Type Description
bool
| Edit this page View Source

Range

Property to return the range between the two values.

Declaration
[JsonIgnore]
public double Range { get; }
Property Value
Type Description
double

Methods

| Edit this page View Source

Add(GorgonRangeD, GorgonRangeD)

Function to add two GorgonRangeD values together.

Declaration
public static GorgonRangeD Add(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left GorgonRangeD value to add

GorgonRangeD right

The right GorgonRangeD value to add.

Returns
Type Description
GorgonRangeD

A new GorgonRangeD representing the total of both ranges.

| Edit this page View Source

Add(in GorgonRangeD, in GorgonRangeD, out GorgonRangeD)

Function to add two GorgonRangeD values together.

Declaration
public static void Add(in GorgonRangeD left, in GorgonRangeD right, out GorgonRangeD result)
Parameters
Type Name Description
GorgonRangeD left

The left GorgonRangeD value to add

GorgonRangeD right

The right GorgonRangeD value to add.

GorgonRangeD result

A new GorgonRangeD representing the total of both ranges.

| Edit this page View Source

CompareTo(GorgonRangeD)

Compares the current object with another object of the same type.

Declaration
public int CompareTo(GorgonRangeD other)
Parameters
Type Name Description
GorgonRangeD other

An object to compare with this object.

Returns
Type Description
int

A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.

| Edit this page View Source

Contains(double)

Function to return whether the double value falls within this GorgonRangeD.

Declaration
public bool Contains(double value)
Parameters
Type Name Description
double value

Value to test.

Returns
Type Description
bool

true if the value falls into the range, false if not.

| Edit this page View Source

Divide(GorgonRangeD, double)

Function to divide a GorgonRangeD by a double value.

Declaration
public static GorgonRangeD Divide(GorgonRangeD range, double scalar)
Parameters
Type Name Description
GorgonRangeD range

The GorgonRangeD range value to divide.

double scalar

The double scalar value to divide by.

Returns
Type Description
GorgonRangeD

A new GorgonRangeD representing the product of the range and the scalar.

Exceptions
Type Condition
DivideByZeroException

Thrown if the scalar value is zero.

| Edit this page View Source

Divide(in GorgonRangeD, double, out GorgonRangeD)

Function to divide a GorgonRangeD by a double value.

Declaration
public static void Divide(in GorgonRangeD range, double scalar, out GorgonRangeD result)
Parameters
Type Name Description
GorgonRangeD range

The GorgonRangeD range value to divide.

double scalar

The double scalar value to divide by.

GorgonRangeD result

A new GorgonRangeD representing the product of the range and the scalar.

Exceptions
Type Condition
DivideByZeroException

Thrown if the scalar value is zero.

| Edit this page View Source

Equals(GorgonRangeD)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(GorgonRangeD other)
Parameters
Type Name Description
GorgonRangeD other

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the other parameter; otherwise, false.

| Edit this page View Source

Equals(in GorgonRangeD)

Function to compare this instance with another.

Declaration
public bool Equals(in GorgonRangeD other)
Parameters
Type Name Description
GorgonRangeD other

The other instance to use for comparison.

Returns
Type Description
bool

true if equal, false if not.

| Edit this page View Source

Equals(object)

Indicates whether this instance and a specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

Another object to compare to.

Returns
Type Description
bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

Expand(GorgonRangeD, double)

Function to expand a GorgonRangeD by a specific amount.

Declaration
public static GorgonRangeD Expand(GorgonRangeD range, double amount)
Parameters
Type Name Description
GorgonRangeD range

A GorgonRangeD to expand.

double amount

The amount to expand the GorgonRangeD by.

Returns
Type Description
GorgonRangeD

A new GorgonRangeD value, increased in size by amount.

| Edit this page View Source

Expand(in GorgonRangeD, double, out GorgonRangeD)

Function to expand a GorgonRangeD by a specific amount.

Declaration
public static void Expand(in GorgonRangeD range, double amount, out GorgonRangeD result)
Parameters
Type Name Description
GorgonRangeD range

A GorgonRangeD to expand.

double amount

The amount to expand the GorgonRangeD by.

GorgonRangeD result

A new GorgonRangeD value, increased in size by amount.

| Edit this page View Source

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A 32-bit signed integer that is the hash code for this instance.

Overrides
ValueType.GetHashCode()
| Edit this page View Source

Multiply(GorgonRangeD, GorgonRangeD)

Function to multiply two GorgonRangeD ranges together.

Declaration
public static GorgonRangeD Multiply(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left GorgonRangeD value to multiply.

GorgonRangeD right

The right GorgonRangeD value to multiply.

Returns
Type Description
GorgonRangeD

A new GorgonRangeD value representing the product of both ranges.

| Edit this page View Source

Multiply(GorgonRangeD, double)

Function to multiply a GorgonRangeD by a scalar double value.

Declaration
public static GorgonRangeD Multiply(GorgonRangeD range, double scalar)
Parameters
Type Name Description
GorgonRangeD range

The range to multiply by.

double scalar

The double scalar value to multiply.

Returns
Type Description
GorgonRangeD

A new GorgonRangeD representing the product of the range and the scalar.

| Edit this page View Source

Multiply(in GorgonRangeD, in GorgonRangeD, out GorgonRangeD)

Function to multiply two GorgonRangeD ranges together.

Declaration
public static void Multiply(in GorgonRangeD left, in GorgonRangeD right, out GorgonRangeD result)
Parameters
Type Name Description
GorgonRangeD left

The left GorgonRangeD value to multiply.

GorgonRangeD right

The right GorgonRangeD value to multiply.

GorgonRangeD result

A new GorgonRangeD value representing the product of both ranges.

| Edit this page View Source

Multiply(in GorgonRangeD, double, out GorgonRangeD)

Function to multiply a GorgonRangeD by a scalar double value.

Declaration
public static void Multiply(in GorgonRangeD range, double scalar, out GorgonRangeD result)
Parameters
Type Name Description
GorgonRangeD range

The range to multiply by.

double scalar

The double scalar value to multiply.

GorgonRangeD result

A new GorgonRangeD representing the product of the range and the scalar.

| Edit this page View Source

Shrink(GorgonRangeD, double)

Function to shrink a GorgonRangeD by a specific amount.

Declaration
public static GorgonRangeD Shrink(GorgonRangeD range, double amount)
Parameters
Type Name Description
GorgonRangeD range

A GorgonRangeD to shrink.

double amount

The amount to shrink the GorgonRangeD by.

Returns
Type Description
GorgonRangeD

A new GorgonRangeD value, decreased in size by amount.

| Edit this page View Source

Shrink(in GorgonRangeD, double, out GorgonRangeD)

Function to shrink a GorgonRangeD by a specific amount.

Declaration
public static void Shrink(in GorgonRangeD range, double amount, out GorgonRangeD result)
Parameters
Type Name Description
GorgonRangeD range

A GorgonRangeD to shrink.

double amount

The amount to shrink the GorgonRangeD by.

GorgonRangeD result

A new GorgonRangeD value, decreased in size by amount.

| Edit this page View Source

Subtract(GorgonRangeD, GorgonRangeD)

Function to subtract two GorgonRangeD ranges from each other.

Declaration
public static GorgonRangeD Subtract(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left GorgonRangeD value to subtract.

GorgonRangeD right

The right GorgonRangeD value to subtract.

Returns
Type Description
GorgonRangeD

A new GorgonRangeD value representing the difference of both ranges.

| Edit this page View Source

Subtract(in GorgonRangeD, in GorgonRangeD, out GorgonRangeD)

Function to subtract two GorgonRangeD ranges from each other.

Declaration
public static void Subtract(in GorgonRangeD left, in GorgonRangeD right, out GorgonRangeD result)
Parameters
Type Name Description
GorgonRangeD left

The left GorgonRangeD value to subtract.

GorgonRangeD right

The right GorgonRangeD value to subtract.

GorgonRangeD result

A new GorgonRangeD value representing the difference of both ranges.

| Edit this page View Source

ToGorgonRange(GorgonRangeD)

Function to perform an explicit conversion from GorgonRangeD to GorgonRange.

Declaration
public static GorgonRange ToGorgonRange(GorgonRangeD range)
Parameters
Type Name Description
GorgonRangeD range

The range.

Returns
Type Description
GorgonRange

The result of the conversion.

| Edit this page View Source

ToGorgonRangeF(GorgonRangeD)

Function to perform an explicit conversion from GorgonRangeD to GorgonRangeF.

Declaration
public static GorgonRangeF ToGorgonRangeF(GorgonRangeD range)
Parameters
Type Name Description
GorgonRangeD range

The range.

Returns
Type Description
GorgonRangeF

The result of the conversion.

| Edit this page View Source

ToGorgonRangeM(GorgonRangeD)

Function to perform an explicit conversion from GorgonRangeD to GorgonRangeM.

Declaration
public static GorgonRangeM ToGorgonRangeM(GorgonRangeD range)
Parameters
Type Name Description
GorgonRangeD range

The range.

Returns
Type Description
GorgonRangeM

The result of the conversion.

| Edit this page View Source

ToString()

Returns the fully qualified type name of this instance.

Declaration
public override string ToString()
Returns
Type Description
string

A string containing a fully qualified type name.

Overrides
ValueType.ToString()

Operators

| Edit this page View Source

operator +(GorgonRangeD, GorgonRangeD)

Implements the operator +.

Declaration
public static GorgonRangeD operator +(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left range.

GorgonRangeD right

The right range.

Returns
Type Description
GorgonRangeD

The result of the operator.

| Edit this page View Source

operator /(GorgonRangeD, double)

Implements the operator /.

Declaration
public static GorgonRangeD operator /(GorgonRangeD left, double scalar)
Parameters
Type Name Description
GorgonRangeD left

The left range.

double scalar

The right scalar value.

Returns
Type Description
GorgonRangeD

The result of the operator.

| Edit this page View Source

operator ==(GorgonRangeD, GorgonRangeD)

Implements the operator ==.

Declaration
public static bool operator ==(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left.

GorgonRangeD right

The right.

Returns
Type Description
bool

The result of the operator.

| Edit this page View Source

explicit operator GorgonRange(GorgonRangeD)

Performs an explicit conversion from GorgonRangeD to GorgonRange.

Declaration
public static explicit operator GorgonRange(GorgonRangeD range)
Parameters
Type Name Description
GorgonRangeD range

The range.

Returns
Type Description
GorgonRange

The result of the conversion.

| Edit this page View Source

explicit operator GorgonRangeF(GorgonRangeD)

Performs an explicit conversion from GorgonRangeD to GorgonRangeF.

Declaration
public static explicit operator GorgonRangeF(GorgonRangeD range)
Parameters
Type Name Description
GorgonRangeD range

The range.

Returns
Type Description
GorgonRangeF

The result of the conversion.

| Edit this page View Source

explicit operator GorgonRangeM(GorgonRangeD)

Performs an explicit conversion from GorgonRangeD to GorgonRangeM.

Declaration
public static explicit operator GorgonRangeM(GorgonRangeD range)
Parameters
Type Name Description
GorgonRangeD range

The range.

Returns
Type Description
GorgonRangeM

The result of the conversion.

| Edit this page View Source

operator >(GorgonRangeD, GorgonRangeD)

Implements the operator >.

Declaration
public static bool operator >(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left instance to compare.

GorgonRangeD right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator >=(GorgonRangeD, GorgonRangeD)

Implements the operator >=.

Declaration
public static bool operator >=(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left instance to compare.

GorgonRangeD right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator !=(GorgonRangeD, GorgonRangeD)

Implements the operator ==.

Declaration
public static bool operator !=(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left.

GorgonRangeD right

The right.

Returns
Type Description
bool

The result of the operator.

| Edit this page View Source

operator <(GorgonRangeD, GorgonRangeD)

Implements the operator >.

Declaration
public static bool operator <(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left instance to compare.

GorgonRangeD right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator <=(GorgonRangeD, GorgonRangeD)

Implements the operator >=.

Declaration
public static bool operator <=(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left instance to compare.

GorgonRangeD right

The right instance to compare.

Returns
Type Description
bool

true if left is greater than right.

| Edit this page View Source

operator *(GorgonRangeD, GorgonRangeD)

Implements the operator *.

Declaration
public static GorgonRangeD operator *(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left range.

GorgonRangeD right

The right range.

Returns
Type Description
GorgonRangeD

The result of the operator.

| Edit this page View Source

operator *(GorgonRangeD, double)

Implements the operator *.

Declaration
public static GorgonRangeD operator *(GorgonRangeD left, double scalar)
Parameters
Type Name Description
GorgonRangeD left

The left range.

double scalar

The right scalar value.

Returns
Type Description
GorgonRangeD

The result of the operator.

| Edit this page View Source

operator *(double, GorgonRangeD)

Implements the operator *.

Declaration
public static GorgonRangeD operator *(double scalar, GorgonRangeD right)
Parameters
Type Name Description
double scalar

The scalar value.

GorgonRangeD right

The right scalar value.

Returns
Type Description
GorgonRangeD

The result of the operator.

| Edit this page View Source

operator -(GorgonRangeD, GorgonRangeD)

Implements the operator -.

Declaration
public static GorgonRangeD operator -(GorgonRangeD left, GorgonRangeD right)
Parameters
Type Name Description
GorgonRangeD left

The left range.

GorgonRangeD right

The right range.

Returns
Type Description
GorgonRangeD

The result of the operator.

Implements

IGorgonEquatableByRef<T>
IEquatable<T>
IComparable<T>

Extension Methods

GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author