@@ -268,13 +268,23 @@ function Base.:(*)(m::Mat{4,4,T}, h::Rect{3,T}) where T
268
268
Rect {3,T} (_vmin, _vmax - _vmin)
269
269
end
270
270
271
- function Base.:(- )(h:: Rect{N, T} , move:: Vec{N} ) where {N,T}
271
+ Base.:(- )(h:: Rect{N, T} , move:: Number ) where {N,T} = h - Vec {N, N} (move)
272
+ Base.:(+ )(h:: Rect{N, T} , move:: Number ) where {N,T} = h + Vec {N, N} (move)
273
+
274
+
275
+ function Base.:(- )(h:: Rect{N, T} , move:: StaticVector{N} ) where {N,T}
272
276
Rect {N, T} (minimum (h) .- move, widths (h))
273
277
end
274
- function Base.:(+ )(h:: Rect{N, T} , move:: Vec{N} ) where {N,T}
278
+
279
+ function Base.:(+ )(h:: Rect{N, T} , move:: StaticVector{N} ) where {N,T}
275
280
Rect {N, T} (minimum (h) .+ move, widths (h))
276
281
end
277
282
283
+
284
+ function Base.:(* )(rect:: Rect , scaling:: Union{Number, StaticVector} )
285
+ return Rect (minimum (rect) .* scaling, widths (rect) .* scaling)
286
+ end
287
+
278
288
# Enables rectangular indexing into a matrix
279
289
function Base. to_indices (A:: AbstractMatrix{T} , I:: Tuple{Rect2D{IT}} ) where {T, IT<: Integer }
280
290
rect = I[1 ]
0 commit comments