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

Function main

examples/graphics/surface.cpp:19–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17static const int N = 2 * M;
18
19int main(int, char**) {
20 try {
21 // Initialize the kernel array just once
22 af::info();
23 af::Window myWindow(800, 800, "3D Surface example: ArrayFire");
24
25 // Creates grid of between [-1 1] with precision of 1 / M
26 const array x = iota(dim4(N, 1), dim4(1, N)) / M - 1;
27 const array y = iota(dim4(1, N), dim4(N, 1)) / M - 1;
28
29 static float t = 0;
30 while (!myWindow.close()) {
31 t += 0.07;
32 array z = 10 * x * -abs(y) * cos(x * x * (y + t)) +
33 sin(y * (x + t)) - 1.5;
34 myWindow.surface(x, y, z);
35 }
36
37 } catch (af::exception& e) {
38 fprintf(stderr, "%s\n", e.what());
39 throw;
40 }
41 return 0;
42}

Callers

nothing calls this directly

Calls 8

infoFunction · 0.85
cosFunction · 0.85
sinFunction · 0.85
closeMethod · 0.80
surfaceMethod · 0.80
iotaFunction · 0.50
dim4Class · 0.50
absFunction · 0.50

Tested by

no test coverage detected