@@ -578,48 +578,120 @@ func (g *InfGrid[T]) GetN(x, y int, dims ...int) T {
578578 return g .Get (x , y + 1 , dims ... )
579579}
580580
581+ // GetNMany is like GetN but returns count values
582+ func (g * InfGrid [T ]) GetNMany (x , y int , count int , dims ... int ) []T {
583+ r := []T {}
584+ for i := 1 ; i <= count ; i ++ {
585+ r = append (r , g .Get (x , y + i , dims ... ))
586+ }
587+ return r
588+ }
589+
581590// GetE will return the value east of the given coordinate (x+1), if the coordinate is outside the extents
582591// of the grid returns the default value
583592func (g * InfGrid [T ]) GetE (x , y int , dims ... int ) T {
584593 return g .Get (x + 1 , y , dims ... )
585594}
586595
596+ // GetEMany is like GetE but returns count values
597+ func (g * InfGrid [T ]) GetEMany (x , y int , count int , dims ... int ) []T {
598+ r := []T {}
599+ for i := 1 ; i <= count ; i ++ {
600+ r = append (r , g .Get (x + i , y , dims ... ))
601+ }
602+ return r
603+ }
604+
587605// GetS will return the value south of the given coordinate (y-1), if the coordinate is outside the extents
588606// of the grid returns the default value
589607func (g * InfGrid [T ]) GetS (x , y int , dims ... int ) T {
590608 return g .Get (x , y - 1 , dims ... )
591609}
592610
611+ // GetSMany is like GetS but returns count values
612+ func (g * InfGrid [T ]) GetSMany (x , y int , count int , dims ... int ) []T {
613+ r := []T {}
614+ for i := 1 ; i <= count ; i ++ {
615+ r = append (r , g .Get (x , y - i , dims ... ))
616+ }
617+ return r
618+ }
619+
593620// GetW will return the value west of the given coordinate (x-1), if the coordinate is outside the extents
594621// of the grid returns the default value
595622func (g * InfGrid [T ]) GetW (x , y int , dims ... int ) T {
596623 return g .Get (x - 1 , y , dims ... )
597624}
598625
626+ // GetWMany is like GetW but returns count values
627+ func (g * InfGrid [T ]) GetWMany (x , y int , count int , dims ... int ) []T {
628+ r := []T {}
629+ for i := 1 ; i <= count ; i ++ {
630+ r = append (r , g .Get (x - i , y , dims ... ))
631+ }
632+ return r
633+ }
634+
599635// GetNE will return the value north-east of the given coordinate (x+1, y+1), if the coordinate is outside the extents
600636// of the grid returns the default value
601637func (g * InfGrid [T ]) GetNE (x , y int , dims ... int ) T {
602638 return g .Get (x + 1 , y + 1 , dims ... )
603639}
604640
641+ // GetNEMany is like GetNE but returns count values
642+ func (g * InfGrid [T ]) GetNEMany (x , y int , count int , dims ... int ) []T {
643+ r := []T {}
644+ for i := 1 ; i <= count ; i ++ {
645+ r = append (r , g .Get (x + i , y + i , dims ... ))
646+ }
647+ return r
648+ }
649+
605650// GetSE will return the value south-east of the given coordinate (x+1, y-1), if the coordinate is outside the extents
606651// of the grid returns the default value
607652func (g * InfGrid [T ]) GetSE (x , y int , dims ... int ) T {
608653 return g .Get (x + 1 , y - 1 , dims ... )
609654}
610655
656+ // GetSEMany is like GetSE but returns count values
657+ func (g * InfGrid [T ]) GetSEMany (x , y int , count int , dims ... int ) []T {
658+ r := []T {}
659+ for i := 1 ; i <= count ; i ++ {
660+ r = append (r , g .Get (x + i , y - i , dims ... ))
661+ }
662+ return r
663+ }
664+
611665// GetSW will return the value south-west of the given coordinate (x-1, y-1), if the coordinate is outside the extents
612666// of the grid returns the default value
613667func (g * InfGrid [T ]) GetSW (x , y int , dims ... int ) T {
614668 return g .Get (x - 1 , y - 1 , dims ... )
615669}
616670
671+ // GetSWMany is like GetSW but returns count values
672+ func (g * InfGrid [T ]) GetSWMany (x , y int , count int , dims ... int ) []T {
673+ r := []T {}
674+ for i := 1 ; i <= count ; i ++ {
675+ r = append (r , g .Get (x - i , y - i , dims ... ))
676+ }
677+ return r
678+ }
679+
617680// GetNW will return the value north-west of the given coordinate (x-1, y+1), if the coordinate is outside the extents
618681// of the grid returns the default value
619682func (g * InfGrid [T ]) GetNW (x , y int , dims ... int ) T {
620683 return g .Get (x - 1 , y + 1 , dims ... )
621684}
622685
686+ // GetNWMany is like GetNW but returns count values
687+ func (g * InfGrid [T ]) GetNWMany (x , y int , count int , dims ... int ) []T {
688+ r := []T {}
689+ for i := 1 ; i <= count ; i ++ {
690+ r = append (r , g .Get (x - i , y + i , dims ... ))
691+ }
692+ return r
693+ }
694+
623695// GetOrtho will return the values north, east, south, and west of the given coordinate, if a coordinate is outside
624696// the extents of the grid it will be set to the default
625697func (g * InfGrid [T ]) GetOrtho (x , y int , dims ... int ) []T {
0 commit comments