/// <summary> /// converts the DynamicBuffer<FloatBufferElement> to an FloatBufferElement Arrary /// </summary> /// <returns></returns> public static FloatBufferElement[] ToArray(DynamicBuffer <FloatBufferElement> buffer) { FloatBufferElement[] arr = new FloatBufferElement[buffer.Length]; for (int i = 0; i < buffer.Length; i++) { arr[i] = buffer[i]; } return(arr); }
/// <summary> /// converts a float[] into a FloatBufferElement[] /// </summary> /// <param name="arr"></param> /// <returns></returns> public static FloatBufferElement[] ToFloatBufferElementArray(float[] arr) { FloatBufferElement[] tmp = new FloatBufferElement[arr.Length]; for (int i = 0; i < arr.Length; i++) { tmp[i] = new FloatBufferElement { Value = arr[i] } } ; return(tmp); }
/// <summary> /// Compare this FloatBufferElement against a given one /// </summary> /// <param name="other">The other FloatBufferElement to compare to</param> /// <returns>Difference based on the FloatBufferElement value</returns> public int CompareTo(FloatBufferElement other) { float tmp = Value - other.Value; if (tmp < 0) { return(-1); } else if (tmp == 0) { return(0); } else { return(1); } }