add docs to scale, rotate

This commit is contained in:
Simon Christ 2022-04-05 14:52:51 +02:00
parent 8a584ceab4
commit e691a42b90

View File

@ -159,10 +159,15 @@ function scale!(shape::Shape, x::Real, y::Real = x, c = center(shape))
shape
end
"""
scale(shape, x, y = x, c = center(shape))
scale!(shape, x, y = x, c = center(shape))
Scale shape by a factor.
"""
scale(shape::Shape, x::Real, y::Real = x, c = center(shape)) =
scale!(deepcopy(shape), x, y, c)
"translate a Shape in space"
function translate!(shape::Shape, x::Real, y::Real = x)
sx, sy = coords(shape)
for i in eachindex(sx)
@ -172,6 +177,12 @@ function translate!(shape::Shape, x::Real, y::Real = x)
shape
end
"""
translate(shape, x, y = x)
translate!(shape, x, y = x)
Translate a Shape in space.
"""
translate(shape::Shape, x::Real, y::Real = x) = translate!(deepcopy(shape), x, y)
rotate_x(x::Real, y::Real, θ::Real, centerx::Real, centery::Real) =