2024-12-10 18:55:23 -05:00
|
|
|
package gamedata
|
|
|
|
|
|
2024-12-14 06:36:45 -05:00
|
|
|
import "math"
|
|
|
|
|
|
2024-12-10 18:55:23 -05:00
|
|
|
type Coordinates struct {
|
|
|
|
|
X float64
|
|
|
|
|
Y float64
|
|
|
|
|
}
|
2024-12-14 06:36:45 -05:00
|
|
|
|
|
|
|
|
func (c Coordinates) Distance(p Coordinates) float64 {
|
|
|
|
|
dx := p.X - c.X
|
|
|
|
|
dy := p.Y - c.Y
|
|
|
|
|
return math.Sqrt(dx*dx + dy*dy)
|
|
|
|
|
}
|