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{}}
|
zRanges: map[int16]*zRange{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s2d *Coverage3D) Insert(c Coord) {
|
func (c3d *Coverage3D) Insert(c Coord) {
|
||||||
s2d.mu.Lock()
|
c3d.mu.Lock()
|
||||||
defer s2d.mu.Unlock()
|
defer c3d.mu.Unlock()
|
||||||
zr := s2d.zRanges[c.Z]
|
zr := c3d.zRanges[c.Z]
|
||||||
if zr == nil {
|
if zr == nil {
|
||||||
xr := s2d.pool.Alloc()
|
xr := c3d.pool.Alloc()
|
||||||
xr.From = int32(c.X)
|
xr.From = int32(c.X)
|
||||||
xr.To = int32(c.X)
|
xr.To = int32(c.X)
|
||||||
xr.Next = nil
|
xr.Next = nil
|
||||||
s2d.zRanges[c.Z] = &zRange{
|
c3d.zRanges[c.Z] = &zRange{
|
||||||
y1: c.Y,
|
y1: c.Y,
|
||||||
y2: c.Y,
|
y2: c.Y,
|
||||||
xRange: xr}
|
xRange: xr}
|
||||||
return
|
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 {
|
if c.Y < zr.y1 {
|
||||||
zr.y1 = c.Y
|
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)
|
c1, c2 = MinCoord(c1, c2), MaxCoord(c1, c2)
|
||||||
|
|
||||||
s2d.mu.RLock()
|
c3d.mu.RLock()
|
||||||
defer s2d.mu.RUnlock()
|
defer c3d.mu.RUnlock()
|
||||||
|
|
||||||
r := make([]Range, 0, 32)
|
r := make([]Range, 0, 32)
|
||||||
for z := c1.Z; z <= c2.Z; z++ {
|
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 {
|
if zr == nil || c1.Y > zr.y2 || c2.Y < zr.y1 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user