Table of Contents

Class MatrixFloat

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

A matrix of float values.

[Serializable]
[Version(4, 5, 0)]
public sealed class MatrixFloat : IEnumerable<float>, IEnumerable, ISerializationCallbackReceiver
Inheritance
MatrixFloat
Implements
ISerializationCallbackReceiver
Inherited Members
Extension Methods

Remarks

This type is meant to be used in the inspector, and has a PropertyDrawer implemented. It is mutable, and not suitable for mathematical operations. The mutation methods provided are to implement the drawer tools.

You can register presets using RegisterValuesRetriever<T>(string, Func<IEnumerable<T>>). The retriever function should return an IDictionary<TKey, TValue> with keys of type string and values of type MatrixFloat.

Warning

This type is mutable, so be careful how to use it. If you modify it in code, it is better to Clone() the original, or use SetFrom(MatrixFloat) to initialize your copy.

Constructors

MatrixFloat(int, int, float)

Initializes a new instance of the MatrixFloat class with the specified dimensions and fills the matrix with the given initial value.

MatrixFloat(int, int, float[])

Initializes a new instance of the MatrixFloat class.

Properties

Count

Gets the number of values in this array/

Height

Gets the height of this matrix.

this[int, int]

Gets or sets the value at the specified coordinates.

Width

Gets the width of this matrix.

Methods

AddColumn()

Adds a column to the matrix at the end.

AddRow()

Adds a row to the matrix at the end.

Apply(Func<float, float>)

Applies the given function to each value in this matrix.

Clone()

Creates a copy of this matrix with the same width, height, and values in corresponding places.

CreateEmpty()

Creates a new empty MatrixFloat.

Fill(float)

Sets all slots of the matrix to the given values.

GetEnumerator()
IsConstant()

Calls whether all values in this matrix are effectively the same.

Normalize()

Normalizes the values in this matrix to be between 0 and 1.

OnAfterDeserialize()

Implement this method to receive a callback after Unity deserializes your object.

OnBeforeSerialize()

Implement this method to receive a callback before Unity serializes your object.

RemoveColumn()

Removes the last column from the matrix if there is one.

RemoveRow()

Removes the last row from the matrix if there is one.

SetFrom(MatrixFloat)

Sets the values and dimensions of this matrix from another matrix.