-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcurve.py
More file actions
39 lines (31 loc) · 1021 Bytes
/
testcurve.py
File metadata and controls
39 lines (31 loc) · 1021 Bytes
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import math
import numpy
import physvis as vis
def main():
λx = 40
λy = 50
λz = 20
Tx = 3.797
Ty = 11.312
Tz = 2.045
n = 100
points = numpy.empty( (n, 3) )
points[:, 0] = 2. * numpy.sin( numpy.arange(n) * 2*math.pi/λx )
points[:, 1] = 2. * numpy.sin( numpy.arange(n) * 2*math.pi/λy )
points[:, 2] = 2. * numpy.sin( numpy.arange(n) * 2*math.pi/λz )
basepoints = points.copy()
curve = vis.curve(pos=points, color=vis.color.red, radius=0.1)
fps = 30
t = 0.
while True:
points = basepoints * numpy.array( [ numpy.cos( 2*math.pi * t / Tx ),
numpy.cos( 2*math.pi * t / Ty ),
numpy.cos( 2*math.pi * t / Tz ) ] )
curve.points = points
vis.rate(30)
t += 1./fps
# ======================================================================
if __name__ == "__main__":
main()