Wednesday 11 September 2013

whichtile and floor

To understand the use of whichtile function:

float freq = 5;
column = whichtile(u, freq);
row = whichtile(v,freq);

The definition of whichtile is:

floor(x * freq);
floor function will return the integer value.

example:
0.1 * 5 = 0.5;
floor(0.5) = 0;

0.3 * 5 = 1.5;
floor(1.5) = 1;

floor(2.1) = 2;

floor(6.9) = 6;

and so on....

So the concept is, u and v usually goes from 0 to 1. In whichtile function will take 0 and multiply it to 5 (freq value) then floor function it. Thus:
0.0 * 5 = 0.0;
floor(0.0) = 0;

0.1 * 5 = 0.5;
floor(0.5) = 0;

0.2 * 5 = 1;
floor(1) = 1;

0.3 * 5 = 1.5;
floor(1.5) = 1;

so the result is very much like a staircase:























No comments:

Post a Comment