View Source Exray.Utils.Math (Exray v0.6.0)

Utility functions from raymath.h

Summary

Functions

Clamp float value

A floating point 'good enough' threshold for comparison checks

Check whether two given floats are almost equal.

Calculate linear interpolation between two floats

Normalize input value within input range

Remap input value within input range to output range

Wrap input value from min to max

Functions

@spec clamp(value :: float(), min :: float(), max :: float()) :: float()

Clamp float value

A floating point 'good enough' threshold for comparison checks

@spec float_equals(x :: float(), y :: float()) :: boolean()

Check whether two given floats are almost equal.

Exray developer note: "Meh, looks close enough :^)"

Link to this function

lerp(start, stop, amount)

View Source
@spec lerp(start :: float(), stop :: float(), amount :: float()) :: float()

Calculate linear interpolation between two floats

Link to this function

normalize(value, start, stop)

View Source
@spec normalize(value :: float(), start :: float(), stop :: float()) :: float()

Normalize input value within input range

Link to this function

remap(value, input_start, input_stop, output_start, output_stop)

View Source
@spec remap(
  value :: float(),
  input_start :: float(),
  input_stop :: float(),
  output_start :: float(),
  output_stop :: float()
) :: float()

Remap input value within input range to output range

@spec wrap(value :: float(), min :: float(), max :: float()) :: float()

Wrap input value from min to max