forked from MakieOrg/Makie.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gallery.jl
30 lines (23 loc) · 852 Bytes
/
gallery.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using HTTP
using CSV
using DataFrames
using GLMakie
using LinearAlgebra
url = "https://raw.githubusercontent.com/plotly/datasets/master/vortex.csv"
df = CSV.File(HTTP.get(url).body)|> DataFrame;
uvw = Vec3f.(df.u, df.v, df.w)
len = norm.(uvw)
arrows(df.x, df.y, df.z, df.u, df.v, df.w, linewidth=0, color=len, arrowsize = Vec3f(0.5, 0.5, 1)) |> display
# surface parameterization (u, v)----> (f(u,v), g(u,v), h(u,v)):
f = (u, v) -> cos(v)*(6 - (5/4 +sin(3*u))*sin(u-3*v))
g = (u, v) -> sin(v)*(6 - (5/4 +sin(3*u))*sin(u-3*v))
h = (u, v) -> -cos(u-3*v) * (5/4 +sin(3*u));
u = range(0, stop=2π, length=150)
v = range(0, stop=2π, length=150)
tr = surface(f.(u,v'),
g.(u,v'),
h.(u,v'),
ambient=Vec3f(0.5),
diffuse=Vec3f(1),
specular=0.5,
colormap=:balance) |> display