Skip to content

Instantly share code, notes, and snippets.

@jstrube
Created August 28, 2021 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstrube/df26cc213ff2c24bd83a2c70e145a355 to your computer and use it in GitHub Desktop.
Save jstrube/df26cc213ff2c24bd83a2c70e145a355 to your computer and use it in GitHub Desktop.
Plotting the ZVTop algorithm on three tracks
using GLMakie
const σT = 0.3
function tube(x0, κ, ϕ, x, y)
exp(-0.5*(x*cos(ϕ) + y*sin(ϕ) - x0 - κ*(y*cos(ϕ) - x*sin(ϕ))^2)^2 / σT^2)
end
f1(x, y) = tube(0, 0.01, 1.05, x, y)
f2(x, y) = tube(0.1, 0.005, 0, x, y)
f3(x, y) = tube(-0.1, 0.01, 2.8, x, y)
d1 = [f1(x, y) for x=-5:0.1:5, y=-10:0.1:10]
d2 = [f2(x, y) for x=-5:0.1:5, y=-10:0.1:10]
d3 = [f3(x, y) for x=-5:0.1:5, y=-10:0.1:10]
surface(collect(-5:0.1:5), collect(-10:0.1:10), d1)
surface!(collect(-5:0.1:5), collect(-10:0.1:10), d2)
surface!(collect(-5:0.1:5), collect(-10:0.1:10), d3)
overlap(x, y) = f1(x,y) + f2(x,y) + f3(x,y) - (f1(x,y)^2 + f2(x,y)^2 + f3(x,y)^2)/ (f1(x,y) + f2(x,y) + f3(x,y))
d4 = [overlap(x, y) for x=-5:0.1:5, y=-10:0.1:10]
surface(collect(-5:0.1:5), collect(-10:0.1:10), d4)
@jstrube
Copy link
Author

jstrube commented Aug 28, 2021

This is a Julia translation of the Maple worksheet tubePlotting.mw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment