Maths.IndexMap

References
public sealed class Maths.IndexMap : IEquatable<Maths.IndexMap>
An integer array of length N containing all the integers from 0 to N-1. This map encodes a specific (re)ordering of items in an array. Grasshopper uses index mapping instead of in-place sorting so that a specific ordering can be cheaply applied to more than one collection.

Constructors

IndexMap

#
Create a new index map. The validity of the map is not tested. If you are suspicious about a map you must call Validate() yourself.
public IndexMap(
params int[]
map
)

Properties

Array

#
Return the internal array. Note that this does not create a copy of the array, so changes made to the returned instance will modify this index map. Do so at your own peril.
public int[] Array { get; }

Length

#
Gets the size of this map.
public int Length { get; }

Indexers

this[]

#
Gets the mapping at the given index.
public int this[
index
] { get; }

Methods

Apply<T>

#
Apply this mapping to an existing array.
public T[] Apply<T>(
T[]
array
)

Combine

#
Combine multiple maps into a single map which encodes the ordering of both.
public static Maths.IndexMap Combine(
params IndexMap[]
maps
)

Equals

#
public bool Equals(
other
)

Equals

#
public override bool Equals(
obj
)
Object.Equals

GetHashCode

#
public override int GetHashCode()

Identity

#
Create an identity mapping of the given length.
public static Maths.IndexMap Identity(
count
)

Invert

#
Invert the index map. This can also be used to create an array of integers which can be used as sorting keys.
public Maths.IndexMap Invert()

Validate

#
Ensure that each integers from zero to count-1 appears exactly once in this mapping.
public bool Validate(
out string
reason
)