| 17 | static const float PRECISION = 1.0f / ITERATIONS; |
| 18 | |
| 19 | int main(int, char**) { |
| 20 | try { |
| 21 | // Initialize the kernel array just once |
| 22 | af::info(); |
| 23 | af::Window myWindow(800, 800, "3D Line Plot example: ArrayFire"); |
| 24 | |
| 25 | static float t = 0.1; |
| 26 | array Z = seq(0.1f, 10.f, PRECISION); |
| 27 | |
| 28 | do { |
| 29 | array Y = sin((Z * t) + t) / Z; |
| 30 | array X = cos((Z * t) + t) / Z; |
| 31 | X = max(min(X, 1.0), -1.0); |
| 32 | Y = max(min(Y, 1.0), -1.0); |
| 33 | |
| 34 | // Pts can be passed in as a matrix in the form n x 3, 3 x n |
| 35 | // or in the flattened xyz-triplet array with size 3n x 1 |
| 36 | myWindow.plot(X, Y, Z); |
| 37 | |
| 38 | t += 0.01; |
| 39 | } while (!myWindow.close()); |
| 40 | |
| 41 | } catch (af::exception& e) { |
| 42 | fprintf(stderr, "%s\n", e.what()); |
| 43 | throw; |
| 44 | } |
| 45 | return 0; |
| 46 | } |