-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
38 lines (28 loc) · 1.15 KB
/
example.py
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
31
32
33
34
35
36
37
38
"""
A simple, time-varying vector field plot.
u(x,y,z,t) represents the i-th component of the vector,
v(x,y,z,t) represents the j-th component of the vector,
w(x,y,z,t) represents the k-th component of the vector,
thus,
V(x,y,z,t) = u(x,y,z,t)i + v(x,y,z,t)j + w(x,y,z,t)k,
where i, j, k are the unit vectors to the xyz coordinate system.
"""
# necessary imports
from vis3dvf.plot import Figure
from vis3dvf.vectorfield import *
import numpy as np
# i-th component of the time varying vector field
def u(x,y,z,t):
return 0*x # function must use at leas one of the x,y,z variables (due to numpy)
# j-th component of the time varying vector field
def v(x,y,z,t):
return 0.1*np.sin(t + x)
# k-th component of the time varying vector field
def w(x,y,z,t):
return 0*x # function must use at leas one of the x,y,z variables
# Figure(window width, window height)
fig = Figure(800, 800, "Vector Field")
# VectorFieldT(u, v, w, vector density, initial time, final time, time delta)
fig.add(VectorFieldT(u, v, w, 6, 0, 2*np.pi, 0.05))
# Render field
fig.show()