0

I'm new to Arrayfire and searching for a method like 2D texture sampling.

float uvInit[] = { 0, 0,  1, 1,  1, 0,  0, 1 };
array uv = array(4, 2, uvInit, f32);

float texInit[] = { 1, 2, 3, 4 };
array tex = array(2, 2, texInit, f32);

array color = ???????;
// color should be 1d array { 1, 4, 3, 2 },
// e.g. { tex(0, 0), tex(1, 1), tex(1, 0), tex(0, 1) }.

Searched for documentation but not found anything like this, and I cannot even index an array with array element...

array s = ..., g = ...;
gfor(seq i, ...) {
    auto x = g(0, i);    // take an element from g.
    s(x);                // ERROR: no matched function.
}
karatoga
  • 513
  • 4
  • 14

1 Answers1

1

The closest sibling for interpolation in ArrayFire are the functions listed in the below page.

http://arrayfire.org/docs/group__approx__mat.htm

If you are new to ArrayFire/indexing, I strongly recommend you to go through the documentation tutorials.

http://arrayfire.org/docs/indexing.htm

The whole list of tutorials(may not be comprehensive, but a very good starter) is given at the following URL.

http://arrayfire.org/docs/usergroup0.htm

pradeep
  • 712
  • 4
  • 13