File: plot3.py

package info (click to toggle)
python-arrayfire 3.3.20160624-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 764 kB
  • ctags: 826
  • sloc: python: 3,999; makefile: 205
file content (33 lines) | stat: -rw-r--r-- 762 bytes parent folder | download
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
#!/usr/bin/python

#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
########################################################

import arrayfire as af

af.info()

ITERATIONS = 200
POINTS = int(10.0 * ITERATIONS)

Z = 1 + af.range(POINTS) / ITERATIONS

win = af.Window(800, 800, "3D Plot example using ArrayFire")

t = 0.1
while not win.close():
    X = af.cos(Z * t + t) / Z
    Y = af.sin(Z * t + t) / Z

    X = af.maxof(af.minof(X, 1), -1)
    Y = af.maxof(af.minof(Y, 1), -1)

    Pts = af.join(1, X, Y, Z)
    win.plot3(Pts)
    t = t + 0.01