Skip to content

Commit f7a29f0

Browse files
authored
Improve Rotate docs (#1031)
* Improve Rotate docs * Fix docs
1 parent 794e1d7 commit f7a29f0

File tree

2 files changed

+19
-32
lines changed

2 files changed

+19
-32
lines changed

docs/src/transforms.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ Rotate
3030
```
3131

3232
```@example transforms
33-
using Rotations: Angle2d
34-
3533
grid = CartesianGrid(10, 10)
3634
37-
mesh = grid |> Rotate(Angle2d(π/4))
35+
mesh = grid |> Rotate(π/4)
3836
3937
fig = Mke.Figure(size = (800, 400))
4038
viz(fig[1,1], grid)
@@ -83,6 +81,8 @@ Affine
8381
```
8482

8583
```@example transforms
84+
using Rotations: Angle2d
85+
8686
grid = CartesianGrid(10, 10)
8787
8888
mesh = grid |> Affine(Angle2d(π/4), [10., 20.])

src/transforms/rotate.jl

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,39 @@
33
# ------------------------------------------------------------------
44

55
"""
6-
Rotate(rot)
6+
Rotate(R)
77
8-
Rotate geometry or mesh with rotation `rot`
9-
from Rotations.jl.
8+
Rotate geometry or domain with rotation `R` from Rotations.jl.
109
11-
## Examples
12-
13-
```julia
14-
Rotate(one(RotXYZ{Float64})) # Generate identity rotation
15-
Rotate(AngleAxis(0.2, 1.0, 0.0, 0.0)) # Rotate 0.2 radians around X-axis
16-
Rotate(rand(QuatRotation{Float64})) # Generate random rotation
17-
```
18-
"""
19-
struct Rotate{R<:Rotation} <: CoordinateTransform
20-
rot::R
21-
end
22-
23-
"""
2410
Rotate(u, v)
2511
2612
Rotation mapping the axis directed by `u` to the axis directed by `v`.
2713
More precisely, it maps the plane passing through the origin with normal
2814
vector `u` to the plane passing through the origin with normal vector `v`.
2915
16+
Rotate(θ)
17+
18+
Rotate the 2D geometry or domain by angle `θ`, in radians, using the
19+
`Angle2d` rotation.
20+
3021
## Examples
3122
3223
```julia
33-
Rotate(Vec(1, 0, 0), Vec(1, 1, 1))
24+
Rotate(one(RotXYZ{Float64})) # identity rotation
25+
Rotate(AngleAxis(0.2, 1.0, 0.0, 0.0)) # rotate 0.2 radians around X axis
26+
Rotate(rand(QuatRotation{Float64})) # random rotation
27+
Rotate(Vec(1, 0, 0), Vec(1, 1, 1)) # rotation from (1, 0, 0) to (1, 1, 1)
28+
Rotate(π / 2) # 2D rotation with angle in radians
3429
```
3530
"""
31+
struct Rotate{R<:Rotation} <: CoordinateTransform
32+
rot::R
33+
end
34+
3635
Rotate(u::Vec, v::Vec) = Rotate(urotbetween(u, v))
3736

3837
Rotate(u::Tuple, v::Tuple) = Rotate(Vec(u), Vec(v))
3938

40-
"""
41-
Rotate(θ)
42-
43-
Rotate the 2D geometry or mesh by angle `θ`, in radians,
44-
using the `Angle2d` rotation.
45-
46-
## Examples
47-
48-
```julia
49-
Rotate(π / 2)
50-
```
51-
"""
5239
Rotate(θ) = Rotate(Angle2d(θ))
5340

5441
parameters(t::Rotate) = (; rot=t.rot)

0 commit comments

Comments
 (0)