Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions examples/kitestats.jl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please open the .obj in blender, then you can see that there are internal structures in the .obj file, which will interfere with the calculations you are doing here

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (c) 2025 Bart van de Lint, Uwe Fechner
# SPDX-License-Identifier: MPL-2.0

# Compute bounding box dimensions and projected area of an OBJ file.

using VortexStepMethod: read_faces
using LinearAlgebra: cross

choice = "ram_air_kite"
file = joinpath(@__DIR__, "..", "data", lowercase(choice), choice * "_body.obj")
file = normpath(file) # Normalize path for better error messages

@assert isfile(file) "File not found: $file"

println("File: $file")

vertices, faces = read_faces(file)

xs = [v[1] for v in vertices]
ys = [v[2] for v in vertices]
zs = [v[3] for v in vertices]

xmin, xmax = minimum(xs), maximum(xs)
ymin, ymax = minimum(ys), maximum(ys)
zmin, zmax = minimum(zs), maximum(zs)

println(" x range: $xmin to $xmax")
println(" y range: $ymin to $ymax")
println(" z range: $zmin to $zmax")
println()
println(" Width (x): $(xmax - xmin)")
println(" Height (y): $(ymax - ymin)")
println(" Depth (z): $(zmax - zmin)")

println()
println("="^60)
println("Planform area (view from above, projected onto xy-plane)")
println("="^60)

let
area = 0.0
for face in faces
v1, v2, v3 = vertices[face[1]], vertices[face[2]], vertices[face[3]]
n = cross(v2 - v1, v3 - v1)
# Only count faces pointing upward (positive z)
if n[3] > 0
area += n[3] / 2
end
end
println(" Planform area (xy-projection): $area")
end
3 changes: 2 additions & 1 deletion examples/steering_test_ram_air.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ function plot_turnrate_law(c1, c2, time, v_app, psi, beta, psi_dot, steering)
p1 = plot(time, steering, est_steering;
ylabels=["rel_steering [-]", "est_rel_steering [-]"],
ylims=[(-1.2, 1.2), (-1.2, 1.2)],
legendsize=16,
fig="steering vs est_steering")
display(p1)
end
Expand Down Expand Up @@ -360,7 +361,7 @@ if PLOT
sl = lg.syslog
steering = sl.var_01 ./ MAX_STEERING
steering_setpoint_logged = sl.var_02 ./ MAX_STEERING
p=plotx(sl.time, rad2deg.(sl.elevation), rad2deg.(sl.azimuth), rad2deg.(sl.heading), steering, steering_setpoint_logged; ylabels=["elevation [°]", "azimuth [°]", "heading [°]", "rel_steering [-]", "rel_setpoint [-]"], fig="elevation and azimuth")
p=plotx(sl.time, rad2deg.(sl.elevation), rad2deg.(sl.azimuth), rad2deg.(sl.heading), steering, steering_setpoint_logged; ylabels=["elevation [°]", "azimuth [°]", "heading [°]", "rel_steering [-]", "rel_setpoint [-]"], legendsize=12,fig="elevation and azimuth")
display(p)
end

Expand Down
Loading