You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
904 B
C#
41 lines
904 B
C#
|
1 month ago
|
namespace NaturalNeighbor
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Delaunay graph node identifier
|
||
|
|
/// </summary>
|
||
|
|
public struct NodeId
|
||
|
|
{
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Constructs new node id
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="value">node index</param>
|
||
|
|
public NodeId(int value)
|
||
|
|
{
|
||
|
|
_value = value;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Returns the underlying ordinal value
|
||
|
|
/// </summary>
|
||
|
|
/// <param name="id"></param>
|
||
|
|
public static explicit operator int(NodeId id)
|
||
|
|
{
|
||
|
|
return id._value;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// String representation of node id
|
||
|
|
/// </summary>
|
||
|
|
/// <returns>string</returns>
|
||
|
|
public override string ToString()
|
||
|
|
{
|
||
|
|
return $"NodeId={_value}";
|
||
|
|
}
|
||
|
|
|
||
|
|
internal bool IsSentinel => _value < 4;
|
||
|
|
|
||
|
|
readonly int _value;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|