func (l *List2D[T]) CopyRect(x, y, width, height int) *List2D[T] {
	l2 := &List2D[T]{
		data:   make([]T, width*height),
		width:  width,
		height: height,
	}
	for lx := 0; lx < width; lx++ {
		for ly := 0; ly < height; ly++ {
			l2.Set(lx, ly, l.Get(x+lx, y+ly))
		}
	}
	return l2
}
// Copy returns a copy of the list determined by the given parameters.
// It panics if the given parameters are out of bounds.
Copy returns a copy of the list determined by the given parameters.
It panics if the given parameters are out of bounds.
// Copy returns a copy of the list determined by the given parameters . // It panics if the given parameters are out of bounds .
func (l *List2D[T]) CopyRect(x, y, width, height int) *List2D[T] {
	l2 := &List2D[T]{
		data:   make([]T, width*height),
		width:  width,
		height: height,
	}
	for lx := 0; lx < width; lx++ {
		for ly := 0; ly < height; ly++ {
			l2.Set(lx, ly, l.Get(x+lx, y+ly))
		}
	}
	return l2
}
func ( l * List2D [ T ] ) CopyRect ( x , y , width , height int ) * List2D [ T ] { l2 := & List2D [ T ] { data : make ( [ ] T , width * height ) , width : width , height : height , } for lx := 0 ; lx < width ; lx ++ { for ly := 0 ; ly < height ; ly ++ { l2 . Set ( lx , ly , l . Get ( x + lx , y + ly ) ) } } return l2 }
Copy returns a copy of the list determined by the given parameters.
Copy returns a copy of the list determined by the given parameters .