mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-03 00:20:48 +02:00
Clip coordinates in interleaved spatial queries to world boundaries.
This commit is contained in:
@ -59,6 +59,23 @@ func maxComponent(a, b int16) int16 {
|
||||
return b
|
||||
}
|
||||
|
||||
func clipComponent(x int16) int16 {
|
||||
if x < minValue {
|
||||
return minValue
|
||||
}
|
||||
if x > maxValue {
|
||||
return maxValue
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
func ClipCoord(c Coord) Coord {
|
||||
return Coord{
|
||||
X: clipComponent(c.X),
|
||||
Y: clipComponent(c.Y),
|
||||
Z: clipComponent(c.Z)}
|
||||
}
|
||||
|
||||
func MinCoord(a, b Coord) Coord {
|
||||
return Coord{
|
||||
X: minComponent(a.X, b.X),
|
||||
|
Reference in New Issue
Block a user