Skip to content

Commit 355a4f8

Browse files
committed
Add plotting methods
1 parent 40775a6 commit 355a4f8

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
3131

3232
[weakdeps]
3333
ControlPlots = "23c2ee80-7a9e-4350-b264-8e670f12517c"
34+
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
3435

3536
[extensions]
3637
VortexStepMethodControlPlotsExt = "ControlPlots"
38+
VortexStepMethodMakieExt = "Makie"
3739

3840
[compat]
3941
Aqua = "0.8"
@@ -51,6 +53,7 @@ Interpolations = "0.15, 0.16"
5153
LaTeXStrings = "1"
5254
LinearAlgebra = "1"
5355
Logging = "1"
56+
Makie = "0.24.6"
5457
Measures = "0.3"
5558
NonlinearSolve = "4.8.0"
5659
Parameters = "0.12"

ext/VortexStepMethodMakieExt.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module VortexStepMethodMakieExt
2+
using Makie, VortexStepMethod
3+
4+
"""
5+
plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...)
6+
7+
Plot a single `Panel` as a `mesh`.
8+
The corner points are ordered as: LE1, TE1, TE2, LE2.
9+
This creates two triangles: (LE1, TE1, TE2) and (LE1, TE2, LE2).
10+
"""
11+
function Makie.plot!(ax::Makie.Axis3, panel::VortexStepMethod.Panel; kwargs...)
12+
points = [Point3f(panel.corner_points[:, i]) for i in 1:4]
13+
faces = [GLTriangleFace(1, 2, 3), GLTriangleFace(1, 3, 4)]
14+
mesh!(ax, points, faces; kwargs...)
15+
end
16+
17+
"""
18+
plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...)
19+
20+
Plot a `BodyAerodynamics` object by plotting each of its panels.
21+
"""
22+
function Makie.plot!(ax::Makie.Axis3, body::VortexStepMethod.BodyAerodynamics; kwargs...)
23+
for panel in body.panels
24+
Makie.plot!(ax, panel; kwargs...)
25+
end
26+
end
27+
28+
end

0 commit comments

Comments
 (0)