|
3 | 3 | # ------------------------------------------------------------------ |
4 | 4 |
|
5 | 5 | """ |
6 | | - Rotate(rot) |
| 6 | + Rotate(R) |
7 | 7 |
|
8 | | -Rotate geometry or mesh with rotation `rot` |
9 | | -from Rotations.jl. |
| 8 | +Rotate geometry or domain with rotation `R` from Rotations.jl. |
10 | 9 |
|
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 | | -""" |
24 | 10 | Rotate(u, v) |
25 | 11 |
|
26 | 12 | Rotation mapping the axis directed by `u` to the axis directed by `v`. |
27 | 13 | More precisely, it maps the plane passing through the origin with normal |
28 | 14 | vector `u` to the plane passing through the origin with normal vector `v`. |
29 | 15 |
|
| 16 | + Rotate(θ) |
| 17 | +
|
| 18 | +Rotate the 2D geometry or domain by angle `θ`, in radians, using the |
| 19 | +`Angle2d` rotation. |
| 20 | +
|
30 | 21 | ## Examples |
31 | 22 |
|
32 | 23 | ```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 |
34 | 29 | ``` |
35 | 30 | """ |
| 31 | +struct Rotate{R<:Rotation} <: CoordinateTransform |
| 32 | + rot::R |
| 33 | +end |
| 34 | + |
36 | 35 | Rotate(u::Vec, v::Vec) = Rotate(urotbetween(u, v)) |
37 | 36 |
|
38 | 37 | Rotate(u::Tuple, v::Tuple) = Rotate(Vec(u), Vec(v)) |
39 | 38 |
|
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 | | -""" |
52 | 39 | Rotate(θ) = Rotate(Angle2d(θ)) |
53 | 40 |
|
54 | 41 | parameters(t::Rotate) = (; rot=t.rot) |
|
0 commit comments