1
0
forked from MTSR/mapserver
mapserver/types/mapblockcoords.go

33 lines
535 B
Go
Raw Normal View History

2023-12-29 18:00:11 +03:00
package types
2019-01-09 12:52:51 +03:00
import (
"math"
)
2019-01-09 12:52:51 +03:00
type MapBlockCoords struct {
2019-01-21 13:31:50 +03:00
X int `json:"x"`
Y int `json:"y"`
Z int `json:"z"`
2019-01-09 12:52:51 +03:00
}
2019-02-06 10:38:08 +03:00
func NewMapBlockCoords(x, y, z int) *MapBlockCoords {
return &MapBlockCoords{X: x, Y: y, Z: z}
2019-01-09 12:52:51 +03:00
}
2019-01-09 13:11:45 +03:00
func NewMapBlockCoordsFromBlock(x, y, z int) *MapBlockCoords {
return &MapBlockCoords{
X: int(math.Floor(float64(x) / 16)),
Y: int(math.Floor(float64(y) / 16)),
Z: int(math.Floor(float64(z) / 16)),
}
}
2019-01-10 17:21:34 +03:00
type MapBlockRange struct {
2019-02-06 10:38:08 +03:00
Pos1, Pos2 *MapBlockCoords
2019-01-10 17:21:34 +03:00
}
2019-01-09 13:11:45 +03:00
const (
2019-01-13 18:37:03 +03:00
MaxCoord = 2047
MinCoord = -2047
2019-01-09 13:11:45 +03:00
)