Skip to content

Commit c7838ab

Browse files
committed
Add transforms
1 parent 655950c commit c7838ab

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ext/VortexStepMethodMakieExt.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,25 @@ Plot a single `Panel` as a `mesh`.
88
The corner points are ordered as: LE1, TE1, TE2, LE2.
99
This creates two triangles: (LE1, TE1, TE2) and (LE1, TE2, LE2).
1010
"""
11-
function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...)
11+
function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...)
1212
points = [Point3f(panel.corner_points[:, i]) for i in 1:4]
13+
if !isnothing(R_b_w) && !isnothing(T_b_w)
14+
points = [Point3f(R_b_w * p + T_b_w) for p in points]
15+
end
1316
faces = [Makie.GLTriangleFace(1, 2, 3), Makie.GLTriangleFace(1, 3, 4)]
14-
mesh!(ax, points, faces; kwargs...)
17+
mesh!(ax, points, faces; color, kwargs...)
18+
border_points = [points..., points[1]]
19+
lines!(ax, border_points; color=:black)
1520
end
1621

1722
"""
1823
plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...)
1924
2025
Plot a `BodyAerodynamics` object by plotting each of its panels.
2126
"""
22-
function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...)
27+
function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...)
2328
for panel in body.panels
24-
Makie.plot!(ax, panel; kwargs...)
29+
Makie.plot!(ax, panel; color, R_b_w, T_b_w, kwargs...)
2530
end
2631
end
2732

@@ -46,7 +51,6 @@ function Makie.plot(body_aero::VortexStepMethod.BodyAerodynamics; size = (1200,
4651
yautolimitmargin=(limitmargin, limitmargin),
4752
zautolimitmargin=(limitmargin, limitmargin),
4853
)
49-
5054
plot!(ax, body_aero; kwargs...)
5155
return fig
5256
end

0 commit comments

Comments
 (0)