Add some memory reading stuff, based on many other open source projects
This commit is contained in:
13
pkg/utils/utils.go
Normal file
13
pkg/utils/utils.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/hectorgimenez/d2go/pkg/data"
|
||||
"math"
|
||||
)
|
||||
|
||||
func DistanceFromPoint(from data.Position, to data.Position) int {
|
||||
first := math.Pow(float64(to.X-from.X), 2)
|
||||
second := math.Pow(float64(to.Y-from.Y), 2)
|
||||
|
||||
return int(math.Sqrt(first + second))
|
||||
}
|
||||
Reference in New Issue
Block a user