MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / main

Function main

examples/graphics/plot3.cpp:19–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17static const float PRECISION = 1.0f / ITERATIONS;
18
19int 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}

Callers

nothing calls this directly

Calls 8

infoFunction · 0.85
seqClass · 0.85
sinFunction · 0.85
cosFunction · 0.85
plotMethod · 0.80
closeMethod · 0.80
maxFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected