mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-11 09:20:17 +01:00
Fix reciever naming in coverage 3d.
This commit is contained in:
parent
1921b8211b
commit
fb2b03a14a
@ -28,22 +28,22 @@ func NewCoverage3D() *Coverage3D {
|
||||
zRanges: map[int16]*zRange{}}
|
||||
}
|
||||
|
||||
func (s2d *Coverage3D) Insert(c Coord) {
|
||||
s2d.mu.Lock()
|
||||
defer s2d.mu.Unlock()
|
||||
zr := s2d.zRanges[c.Z]
|
||||
func (c3d *Coverage3D) Insert(c Coord) {
|
||||
c3d.mu.Lock()
|
||||
defer c3d.mu.Unlock()
|
||||
zr := c3d.zRanges[c.Z]
|
||||
if zr == nil {
|
||||
xr := s2d.pool.Alloc()
|
||||
xr := c3d.pool.Alloc()
|
||||
xr.From = int32(c.X)
|
||||
xr.To = int32(c.X)
|
||||
xr.Next = nil
|
||||
s2d.zRanges[c.Z] = &zRange{
|
||||
c3d.zRanges[c.Z] = &zRange{
|
||||
y1: c.Y,
|
||||
y2: c.Y,
|
||||
xRange: xr}
|
||||
return
|
||||
}
|
||||
zr.xRange = s2d.pool.Insert(zr.xRange, int32(c.X), 0)
|
||||
zr.xRange = c3d.pool.Insert(zr.xRange, int32(c.X), 0)
|
||||
if c.Y < zr.y1 {
|
||||
zr.y1 = c.Y
|
||||
}
|
||||
@ -52,16 +52,16 @@ func (s2d *Coverage3D) Insert(c Coord) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s2d *Coverage3D) Query(c1, c2 Coord) []Range {
|
||||
func (c3d *Coverage3D) Query(c1, c2 Coord) []Range {
|
||||
|
||||
c1, c2 = MinCoord(c1, c2), MaxCoord(c1, c2)
|
||||
|
||||
s2d.mu.RLock()
|
||||
defer s2d.mu.RUnlock()
|
||||
c3d.mu.RLock()
|
||||
defer c3d.mu.RUnlock()
|
||||
|
||||
r := make([]Range, 0, 32)
|
||||
for z := c1.Z; z <= c2.Z; z++ {
|
||||
zr := s2d.zRanges[z]
|
||||
zr := c3d.zRanges[z]
|
||||
if zr == nil || c1.Y > zr.y2 || c2.Y < zr.y1 {
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user