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

Function ids_from_3D

examples/graphics/gravity_sim.cpp:72–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72af::array ids_from_3D(vector<af::array> &pos, float Rx, float Ry, float Rz) {
73 af::array x0 = (pos[0] - width / 2);
74 af::array y0 =
75 (pos[1] - height / 2) * cos(Rx) + (pos[2] - depth / 2) * sin(Rx);
76 af::array z0 =
77 (pos[2] - depth / 2) * cos(Rx) - (pos[2] - depth / 2) * sin(Rx);
78
79 af::array x1 = x0 * cos(Ry) - z0 * sin(Ry);
80 af::array y1 = y0;
81
82 af::array x2 = x1 * cos(Rz) + y1 * sin(Rz);
83 af::array y2 = y1 * cos(Rz) - x1 * sin(Rz);
84
85 x2 += width / 2;
86 y2 += height / 2;
87
88 return (x2.as(u32) * height) + y2.as(u32);
89}
90
91af::array ids_from_3D(vector<af::array> &pos, float Rx, float Ry, float Rz,
92 af::array filter) {

Callers 1

mainFunction · 0.85

Calls 3

cosFunction · 0.85
sinFunction · 0.85
asMethod · 0.80

Tested by

no test coverage detected