From 355a4f87776b5edea19df6f2e2844d8f9e2b4b04 Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 11:32:13 +0200 Subject: [PATCH 1/8] Add plotting methods --- Project.toml | 3 +++ ext/VortexStepMethodMakieExt.jl | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 ext/VortexStepMethodMakieExt.jl diff --git a/Project.toml b/Project.toml index 580b7d23..5e39dedb 100644 --- a/Project.toml +++ b/Project.toml @@ -31,9 +31,11 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" [weakdeps] ControlPlots = "23c2ee80-7a9e-4350-b264-8e670f12517c" +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" [extensions] VortexStepMethodControlPlotsExt = "ControlPlots" +VortexStepMethodMakieExt = "Makie" [compat] Aqua = "0.8" @@ -51,6 +53,7 @@ Interpolations = "0.15, 0.16" LaTeXStrings = "1" LinearAlgebra = "1" Logging = "1" +Makie = "0.24.6" Measures = "0.3" NonlinearSolve = "4.8.0" Parameters = "0.12" diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl new file mode 100644 index 00000000..d9e1b970 --- /dev/null +++ b/ext/VortexStepMethodMakieExt.jl @@ -0,0 +1,28 @@ +module VortexStepMethodMakieExt +using Makie, VortexStepMethod + +""" + plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...) + +Plot a single `Panel` as a `mesh`. +The corner points are ordered as: LE1, TE1, TE2, LE2. +This creates two triangles: (LE1, TE1, TE2) and (LE1, TE2, LE2). +""" +function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...) + points = [Point3f(panel.corner_points[:, i]) for i in 1:4] + faces = [GLTriangleFace(1, 2, 3), GLTriangleFace(1, 3, 4)] + mesh!(ax, points, faces; kwargs...) +end + +""" + plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...) + +Plot a `BodyAerodynamics` object by plotting each of its panels. +""" +function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...) + for panel in body.panels + Makie.plot!(ax, panel; kwargs...) + end +end + +end From 077eb789dc677b97c32ccd07136e94e8a35f1d9a Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 12:02:45 +0200 Subject: [PATCH 2/8] Plot panels --- examples/ram_air_kite.jl | 189 ++++++++++++++++---------------- ext/VortexStepMethodMakieExt.jl | 28 ++++- 2 files changed, 123 insertions(+), 94 deletions(-) diff --git a/examples/ram_air_kite.jl b/examples/ram_air_kite.jl index f10b8d5b..cd04aefb 100644 --- a/examples/ram_air_kite.jl +++ b/examples/ram_air_kite.jl @@ -1,4 +1,5 @@ -using ControlPlots +using Makie +using GLMakie using VortexStepMethod using LinearAlgebra @@ -17,105 +18,107 @@ wing = RamAirWing( body_aero = BodyAerodynamics([wing];) println("First init") @time VortexStepMethod.reinit!(body_aero) +plot(body_aero.panels[1]) -if DEFORM - # Linear interpolation of alpha from 10° at one tip to 0° at the other - println("Deform") - @time VortexStepMethod.smooth_deform!(wing, deg2rad.([10,20,10,0]), deg2rad.([-10,0,-10,0])) - println("Deform init") - @time VortexStepMethod.reinit!(body_aero; init_aero=false) -end -# Create solvers -solver = Solver(body_aero; - aerodynamic_model_type=VSM, - is_with_artificial_damping=false, - rtol=1e-5, - solver_type=NONLIN -) +# if DEFORM +# # Linear interpolation of alpha from 10° at one tip to 0° at the other +# println("Deform") +# @time VortexStepMethod.smooth_deform!(wing, deg2rad.([10,20,10,0]), deg2rad.([-10,0,-10,0])) +# println("Deform init") +# @time VortexStepMethod.reinit!(body_aero; init_aero=false) +# end -# Setting velocity conditions -v_a = 15.0 -aoa = 10.0 -side_slip = 0.0 -yaw_rate = 0.0 -aoa_rad = deg2rad(aoa) -vel_app = [ - cos(aoa_rad) * cos(side_slip), - sin(side_slip), - sin(aoa_rad) -] * v_a -set_va!(body_aero, vel_app) +# # Create solvers +# solver = Solver(body_aero; +# aerodynamic_model_type=VSM, +# is_with_artificial_damping=false, +# rtol=1e-5, +# solver_type=NONLIN +# ) -if LINEARIZE - println("Linearize") - jac, res = VortexStepMethod.linearize( - solver, - body_aero, - [zeros(4); vel_app; zeros(3)]; - theta_idxs=1:4, - va_idxs=5:7, - omega_idxs=8:10, - moment_frac=0.1) - @time jac, res = VortexStepMethod.linearize( - solver, - body_aero, - [zeros(4); vel_app; zeros(3)]; - theta_idxs=1:4, - va_idxs=5:7, - omega_idxs=8:10, - moment_frac=0.1) -end +# # Setting velocity conditions +# v_a = 15.0 +# aoa = 10.0 +# side_slip = 0.0 +# yaw_rate = 0.0 +# aoa_rad = deg2rad(aoa) +# vel_app = [ +# cos(aoa_rad) * cos(side_slip), +# sin(side_slip), +# sin(aoa_rad) +# ] * v_a +# set_va!(body_aero, vel_app) -# Plotting polar data -PLOT && plot_polar_data(body_aero) +# if LINEARIZE +# println("Linearize") +# jac, res = VortexStepMethod.linearize( +# solver, +# body_aero, +# [zeros(4); vel_app; zeros(3)]; +# theta_idxs=1:4, +# va_idxs=5:7, +# omega_idxs=8:10, +# moment_frac=0.1) +# @time jac, res = VortexStepMethod.linearize( +# solver, +# body_aero, +# [zeros(4); vel_app; zeros(3)]; +# theta_idxs=1:4, +# va_idxs=5:7, +# omega_idxs=8:10, +# moment_frac=0.1) +# end -# Plotting geometry -PLOT && plot_geometry( - body_aero, - ""; - data_type=".svg", - save_path="", - is_save=false, - is_show=true, - view_elevation=15, - view_azimuth=-120, - use_tex=USE_TEX -) +# # Plotting polar data +# PLOT && plot_polar_data(body_aero) -# Solving and plotting distributions -println("Solve") -results = VortexStepMethod.solve(solver, body_aero; log=true) -@time results = solve(solver, body_aero; log=true) +# # Plotting geometry +# PLOT && plot_geometry( +# body_aero, +# ""; +# data_type=".svg", +# save_path="", +# is_save=false, +# is_show=true, +# view_elevation=15, +# view_azimuth=-120, +# use_tex=USE_TEX +# ) -body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels] +# # Solving and plotting distributions +# println("Solve") +# results = VortexStepMethod.solve(solver, body_aero; log=true) +# @time results = solve(solver, body_aero; log=true) -PLOT && plot_distribution( - [body_y_coordinates], - [results], - ["VSM"]; - title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))", - data_type=".pdf", - is_save=false, - is_show=true, - use_tex=USE_TEX -) +# body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels] -PLOT && plot_polars( - [solver], - [body_aero], - [ - "VSM from Ram Air Kite OBJ and DAT file", - ]; - angle_range=range(0, 20, length=20), - angle_type="angle_of_attack", - angle_of_attack=0, - side_slip=0, - v_a=10, - title="ram_kite_panels_$(wing.n_panels)_distribution_$(wing.spanwise_distribution)", - data_type=".pdf", - is_save=false, - is_show=true, - use_tex=USE_TEX -) -nothing \ No newline at end of file +# PLOT && plot_distribution( +# [body_y_coordinates], +# [results], +# ["VSM"]; +# title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))", +# data_type=".pdf", +# is_save=false, +# is_show=true, +# use_tex=USE_TEX +# ) + +# PLOT && plot_polars( +# [solver], +# [body_aero], +# [ +# "VSM from Ram Air Kite OBJ and DAT file", +# ]; +# angle_range=range(0, 20, length=20), +# angle_type="angle_of_attack", +# angle_of_attack=0, +# side_slip=0, +# v_a=10, +# title="ram_kite_panels_$(wing.n_panels)_distribution_$(wing.spanwise_distribution)", +# data_type=".pdf", +# is_save=false, +# is_show=true, +# use_tex=USE_TEX +# ) +# nothing diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index d9e1b970..eb912de1 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -10,7 +10,7 @@ This creates two triangles: (LE1, TE1, TE2) and (LE1, TE2, LE2). """ function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...) points = [Point3f(panel.corner_points[:, i]) for i in 1:4] - faces = [GLTriangleFace(1, 2, 3), GLTriangleFace(1, 3, 4)] + faces = [Makie.GLTriangleFace(1, 2, 3), Makie.GLTriangleFace(1, 3, 4)] mesh!(ax, points, faces; kwargs...) end @@ -25,4 +25,30 @@ function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; k end end +function Makie.plot(panel::VortexStepMethod.Panel; size = (1200, 800), kwargs...) + fig = Figure(; size) + ax = Axis3(fig[1, 1]; aspect = :data, + xlabel = "X", ylabel = "Y", zlabel = "Z", + azimuth = 9/8*π, zoommode = :cursor, viewmode = :fit, + xautolimitmargin=(1.0, 1.0), + yautolimitmargin=(10.0, 10.0), + ) + + plot!(ax, panel; kwargs...) + return fig +end + +function Makie.plot(body_aero::VortexStepMethod.BodyAerodynamics; size = (1200, 800), kwargs...) + fig = Figure(; size) + ax = Axis3(fig[1, 1]; aspect = :data, + xlabel = "X", ylabel = "Y", zlabel = "Z", + azimuth = 9/8*π, zoommode = :cursor, viewmode = :fit, + # xautolimitmargin=(1.0, 1.0), + # yautolimitmargin=(10.0, 10.0), + ) + + plot!(ax, body_aero; kwargs...) + return fig +end + end From 655950c7a50b8aef9d5c3c16ab855a84fb3517ca Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 12:05:02 +0200 Subject: [PATCH 3/8] Plot body aero --- ext/VortexStepMethodMakieExt.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index eb912de1..0ea4f825 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -30,21 +30,21 @@ function Makie.plot(panel::VortexStepMethod.Panel; size = (1200, 800), kwargs... ax = Axis3(fig[1, 1]; aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", azimuth = 9/8*π, zoommode = :cursor, viewmode = :fit, - xautolimitmargin=(1.0, 1.0), - yautolimitmargin=(10.0, 10.0), ) plot!(ax, panel; kwargs...) return fig end -function Makie.plot(body_aero::VortexStepMethod.BodyAerodynamics; size = (1200, 800), kwargs...) +function Makie.plot(body_aero::VortexStepMethod.BodyAerodynamics; size = (1200, 800), + limitmargin = 0.1, kwargs...) fig = Figure(; size) ax = Axis3(fig[1, 1]; aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", azimuth = 9/8*π, zoommode = :cursor, viewmode = :fit, - # xautolimitmargin=(1.0, 1.0), - # yautolimitmargin=(10.0, 10.0), + xautolimitmargin=(limitmargin, limitmargin), + yautolimitmargin=(limitmargin, limitmargin), + zautolimitmargin=(limitmargin, limitmargin), ) plot!(ax, body_aero; kwargs...) From c7838abd0bc7009197a79bd7e87faaa5b6bc566e Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 12:17:19 +0200 Subject: [PATCH 4/8] Add transforms --- ext/VortexStepMethodMakieExt.jl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index 0ea4f825..da110276 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -8,10 +8,15 @@ Plot a single `Panel` as a `mesh`. The corner points are ordered as: LE1, TE1, TE2, LE2. This creates two triangles: (LE1, TE1, TE2) and (LE1, TE2, LE2). """ -function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...) +function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) points = [Point3f(panel.corner_points[:, i]) for i in 1:4] + if !isnothing(R_b_w) && !isnothing(T_b_w) + points = [Point3f(R_b_w * p + T_b_w) for p in points] + end faces = [Makie.GLTriangleFace(1, 2, 3), Makie.GLTriangleFace(1, 3, 4)] - mesh!(ax, points, faces; kwargs...) + mesh!(ax, points, faces; color, kwargs...) + border_points = [points..., points[1]] + lines!(ax, border_points; color=:black) end """ @@ -19,9 +24,9 @@ end Plot a `BodyAerodynamics` object by plotting each of its panels. """ -function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...) +function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) for panel in body.panels - Makie.plot!(ax, panel; kwargs...) + Makie.plot!(ax, panel; color, R_b_w, T_b_w, kwargs...) end end @@ -46,7 +51,6 @@ function Makie.plot(body_aero::VortexStepMethod.BodyAerodynamics; size = (1200, yautolimitmargin=(limitmargin, limitmargin), zautolimitmargin=(limitmargin, limitmargin), ) - plot!(ax, body_aero; kwargs...) return fig end From cbf2c7cc416c975a848d0b2c16b3114510328779 Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 12:27:55 +0200 Subject: [PATCH 5/8] Rebase example --- examples/ram_air_kite.jl | 189 +++++++++++++++++++-------------------- 1 file changed, 93 insertions(+), 96 deletions(-) diff --git a/examples/ram_air_kite.jl b/examples/ram_air_kite.jl index cd04aefb..f10b8d5b 100644 --- a/examples/ram_air_kite.jl +++ b/examples/ram_air_kite.jl @@ -1,5 +1,4 @@ -using Makie -using GLMakie +using ControlPlots using VortexStepMethod using LinearAlgebra @@ -18,107 +17,105 @@ wing = RamAirWing( body_aero = BodyAerodynamics([wing];) println("First init") @time VortexStepMethod.reinit!(body_aero) -plot(body_aero.panels[1]) +if DEFORM + # Linear interpolation of alpha from 10° at one tip to 0° at the other + println("Deform") + @time VortexStepMethod.smooth_deform!(wing, deg2rad.([10,20,10,0]), deg2rad.([-10,0,-10,0])) + println("Deform init") + @time VortexStepMethod.reinit!(body_aero; init_aero=false) +end -# if DEFORM -# # Linear interpolation of alpha from 10° at one tip to 0° at the other -# println("Deform") -# @time VortexStepMethod.smooth_deform!(wing, deg2rad.([10,20,10,0]), deg2rad.([-10,0,-10,0])) -# println("Deform init") -# @time VortexStepMethod.reinit!(body_aero; init_aero=false) -# end - -# # Create solvers -# solver = Solver(body_aero; -# aerodynamic_model_type=VSM, -# is_with_artificial_damping=false, -# rtol=1e-5, -# solver_type=NONLIN -# ) +# Create solvers +solver = Solver(body_aero; + aerodynamic_model_type=VSM, + is_with_artificial_damping=false, + rtol=1e-5, + solver_type=NONLIN +) -# # Setting velocity conditions -# v_a = 15.0 -# aoa = 10.0 -# side_slip = 0.0 -# yaw_rate = 0.0 -# aoa_rad = deg2rad(aoa) -# vel_app = [ -# cos(aoa_rad) * cos(side_slip), -# sin(side_slip), -# sin(aoa_rad) -# ] * v_a -# set_va!(body_aero, vel_app) +# Setting velocity conditions +v_a = 15.0 +aoa = 10.0 +side_slip = 0.0 +yaw_rate = 0.0 +aoa_rad = deg2rad(aoa) +vel_app = [ + cos(aoa_rad) * cos(side_slip), + sin(side_slip), + sin(aoa_rad) +] * v_a +set_va!(body_aero, vel_app) -# if LINEARIZE -# println("Linearize") -# jac, res = VortexStepMethod.linearize( -# solver, -# body_aero, -# [zeros(4); vel_app; zeros(3)]; -# theta_idxs=1:4, -# va_idxs=5:7, -# omega_idxs=8:10, -# moment_frac=0.1) -# @time jac, res = VortexStepMethod.linearize( -# solver, -# body_aero, -# [zeros(4); vel_app; zeros(3)]; -# theta_idxs=1:4, -# va_idxs=5:7, -# omega_idxs=8:10, -# moment_frac=0.1) -# end +if LINEARIZE + println("Linearize") + jac, res = VortexStepMethod.linearize( + solver, + body_aero, + [zeros(4); vel_app; zeros(3)]; + theta_idxs=1:4, + va_idxs=5:7, + omega_idxs=8:10, + moment_frac=0.1) + @time jac, res = VortexStepMethod.linearize( + solver, + body_aero, + [zeros(4); vel_app; zeros(3)]; + theta_idxs=1:4, + va_idxs=5:7, + omega_idxs=8:10, + moment_frac=0.1) +end -# # Plotting polar data -# PLOT && plot_polar_data(body_aero) +# Plotting polar data +PLOT && plot_polar_data(body_aero) -# # Plotting geometry -# PLOT && plot_geometry( -# body_aero, -# ""; -# data_type=".svg", -# save_path="", -# is_save=false, -# is_show=true, -# view_elevation=15, -# view_azimuth=-120, -# use_tex=USE_TEX -# ) +# Plotting geometry +PLOT && plot_geometry( + body_aero, + ""; + data_type=".svg", + save_path="", + is_save=false, + is_show=true, + view_elevation=15, + view_azimuth=-120, + use_tex=USE_TEX +) -# # Solving and plotting distributions -# println("Solve") -# results = VortexStepMethod.solve(solver, body_aero; log=true) -# @time results = solve(solver, body_aero; log=true) +# Solving and plotting distributions +println("Solve") +results = VortexStepMethod.solve(solver, body_aero; log=true) +@time results = solve(solver, body_aero; log=true) -# body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels] +body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels] -# PLOT && plot_distribution( -# [body_y_coordinates], -# [results], -# ["VSM"]; -# title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))", -# data_type=".pdf", -# is_save=false, -# is_show=true, -# use_tex=USE_TEX -# ) +PLOT && plot_distribution( + [body_y_coordinates], + [results], + ["VSM"]; + title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))", + data_type=".pdf", + is_save=false, + is_show=true, + use_tex=USE_TEX +) -# PLOT && plot_polars( -# [solver], -# [body_aero], -# [ -# "VSM from Ram Air Kite OBJ and DAT file", -# ]; -# angle_range=range(0, 20, length=20), -# angle_type="angle_of_attack", -# angle_of_attack=0, -# side_slip=0, -# v_a=10, -# title="ram_kite_panels_$(wing.n_panels)_distribution_$(wing.spanwise_distribution)", -# data_type=".pdf", -# is_save=false, -# is_show=true, -# use_tex=USE_TEX -# ) -# nothing +PLOT && plot_polars( + [solver], + [body_aero], + [ + "VSM from Ram Air Kite OBJ and DAT file", + ]; + angle_range=range(0, 20, length=20), + angle_type="angle_of_attack", + angle_of_attack=0, + side_slip=0, + v_a=10, + title="ram_kite_panels_$(wing.n_panels)_distribution_$(wing.spanwise_distribution)", + data_type=".pdf", + is_save=false, + is_show=true, + use_tex=USE_TEX +) +nothing \ No newline at end of file From 86f08571d4c270616acf04e85dd1c54cd49b58b0 Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 16:50:49 +0200 Subject: [PATCH 6/8] No specific data type --- ext/VortexStepMethodMakieExt.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index da110276..2cdc142a 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -2,13 +2,13 @@ module VortexStepMethodMakieExt using Makie, VortexStepMethod """ - plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...) + plot!(ax, panel::VortexStepMethod.Panel; kwargs...) Plot a single `Panel` as a `mesh`. The corner points are ordered as: LE1, TE1, TE2, LE2. This creates two triangles: (LE1, TE1, TE2) and (LE1, TE2, LE2). """ -function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) +function Makie.plot!(ax, panel::VortexStepMethod.Panel; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) points = [Point3f(panel.corner_points[:, i]) for i in 1:4] if !isnothing(R_b_w) && !isnothing(T_b_w) points = [Point3f(R_b_w * p + T_b_w) for p in points] @@ -20,11 +20,11 @@ function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; color=(:red end """ - plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...) + plot!(ax, body::VortexStepMethod.BodyAerodynamics; kwargs...) Plot a `BodyAerodynamics` object by plotting each of its panels. """ -function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) +function Makie.plot!(ax, body::VortexStepMethod.BodyAerodynamics; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) for panel in body.panels Makie.plot!(ax, panel; color, R_b_w, T_b_w, kwargs...) end From 282ed39ac8c9e9cd92ae0da525caecf27f86df58 Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 17:20:05 +0200 Subject: [PATCH 7/8] Return plots --- ext/VortexStepMethodMakieExt.jl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index 2cdc142a..04f3671d 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -9,14 +9,18 @@ The corner points are ordered as: LE1, TE1, TE2, LE2. This creates two triangles: (LE1, TE1, TE2) and (LE1, TE2, LE2). """ function Makie.plot!(ax, panel::VortexStepMethod.Panel; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) + plots = [] points = [Point3f(panel.corner_points[:, i]) for i in 1:4] if !isnothing(R_b_w) && !isnothing(T_b_w) points = [Point3f(R_b_w * p + T_b_w) for p in points] end faces = [Makie.GLTriangleFace(1, 2, 3), Makie.GLTriangleFace(1, 3, 4)] - mesh!(ax, points, faces; color, kwargs...) + p = mesh!(ax, points, faces; color, kwargs...) + push!(plots, p) border_points = [points..., points[1]] - lines!(ax, border_points; color=:black) + p = lines!(ax, border_points; color=:black) + push!(plots, p) + return plots end """ @@ -25,9 +29,12 @@ end Plot a `BodyAerodynamics` object by plotting each of its panels. """ function Makie.plot!(ax, body::VortexStepMethod.BodyAerodynamics; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing, kwargs...) + plots = [] for panel in body.panels - Makie.plot!(ax, panel; color, R_b_w, T_b_w, kwargs...) + p = Makie.plot!(ax, panel; color, R_b_w, T_b_w, kwargs...) + push!(plots, p) end + return plots end function Makie.plot(panel::VortexStepMethod.Panel; size = (1200, 800), kwargs...) From 5dad870b85014efd231af47a08a1598f786f901c Mon Sep 17 00:00:00 2001 From: 1-Bart-1 Date: Sun, 28 Sep 2025 17:45:13 +0200 Subject: [PATCH 8/8] Remove white stuff --- ext/VortexStepMethodMakieExt.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index 04f3671d..f72ea3d8 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -15,10 +15,10 @@ function Makie.plot!(ax, panel::VortexStepMethod.Panel; color=(:red, 0.2), R_b_w points = [Point3f(R_b_w * p + T_b_w) for p in points] end faces = [Makie.GLTriangleFace(1, 2, 3), Makie.GLTriangleFace(1, 3, 4)] - p = mesh!(ax, points, faces; color, kwargs...) + p = mesh!(ax, points, faces; color, transparency=true, kwargs...) push!(plots, p) border_points = [points..., points[1]] - p = lines!(ax, border_points; color=:black) + p = lines!(ax, border_points; color=:black, transparency=true, kwargs...) push!(plots, p) return plots end