cmd: send group
This commit is contained in:
@@ -2,10 +2,10 @@ package generator
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
|
||||
"github.com/iliadenisov/galaxy/internal/generator/plotter"
|
||||
"github.com/iliadenisov/galaxy/internal/util"
|
||||
)
|
||||
|
||||
type Map struct {
|
||||
@@ -58,15 +58,7 @@ func (m Map) NewCoordinate(deadZoneRaduis float64) (Coordinate, error) {
|
||||
}
|
||||
|
||||
func (m Map) ShortDistance(from, to Coordinate) float64 {
|
||||
dx := math.Abs(to.X - from.X)
|
||||
dy := math.Abs(to.Y - from.Y)
|
||||
if dx > float64(m.Width/2) {
|
||||
dx = float64(m.Width) - dx
|
||||
}
|
||||
if dy > float64(m.Height/2) {
|
||||
dy = float64(m.Height) - dy
|
||||
}
|
||||
return math.Sqrt(math.Pow(dx, 2) + math.Pow(dy, 2))
|
||||
return util.ShortDistance(m.Width, m.Height, from.X, from.Y, to.X, to.Y)
|
||||
}
|
||||
|
||||
// RandI returns a random float64 value between min and max
|
||||
|
||||
Reference in New Issue
Block a user