mirror of
https://github.com/kidoman/embd
synced 2025-01-03 02:21:36 +01:00
add doc
This commit is contained in:
parent
10722b46e4
commit
36c7f3a536
@ -1,5 +1,12 @@
|
||||
// Package util contains utility functions.
|
||||
package util
|
||||
|
||||
// Map re-maps a number from one range to another.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// val := Map(angle, 0, 180, 1000, 2000)
|
||||
//
|
||||
func Map(x, inmin, inmax, outmin, outmax int64) int64 {
|
||||
return (x-inmin)*(outmax-outmin)/(inmax-inmin) + outmin
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user