Struct Modular
Modular distance (shortest distance between two marks on a circle).
Namespace: ISynergy.Framework.Mathematics.Distances
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public struct Modular : IDistance<double>, IDistance<double, double>, IDistance<int>, IDistance<int, int>
Remarks
The modular distance is the distance of two member in a circular space, or a ring. Roughly, it can be understood as the minimum difference between two numbers in this circular space, either going “clockwise” or “counter-clockwise”. For example, in a circle, the modular distance between 1° and 359° is 2° (and not 358°).
References:
Constructors
View SourceModular(Int32)
Initializes a new instance of the Modular class.
Declaration
public Modular(int modulo)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | modulo | The maximum value that the distance can have before it wraps around in the circle (i.e. 360). |
Properties
View SourceModulo
Gets the maximum value that the distance can have before it wraps around in the circle.
Declaration
public readonly int Modulo { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
View SourceClone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
Distance(Double, Double)
Computes the distance d(x,y)
between points
x
and y
.
Declaration
public double Distance(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | The first point |
System.Double | y | The second point |
Returns
Type | Description |
---|---|
System.Double | A double-precision value representing the distance |
Distance(Int32, Int32)
Computes the distance d(x,y)
between points
x
and y
.
Declaration
public double Distance(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The first point |
System.Int32 | y | The second point |
Returns
Type | Description |
---|---|
System.Double | A double-precision value representing the distance |