14 lines
275 B
Go
14 lines
275 B
Go
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))
|
|
}
|