Changes

Jump to: navigation, search

TeamDS

393 bytes added, 12:22, 5 April 2017
The Kernel
int size = width * height;
int i = blockIdx.x * blockDim.x + threadIdx.x;
if(i >= size)
return;
//Vector2 localVec(i - ((i / width) * width), i / width); float lx = i - ((i / width) * width); float ly = i / width; 
float shortestDist = MAX_FLOAT_VALUE;
float pixelVal = src[i];
{
// Calculate distance
//Vector2 targetVec(j - ((j / width) * width), j / width); //float dist = localVec.CalcDistance(targetVec);  float tx = j - ((j / width) * width); float ty = j / width;  float dx = tx - lx; float dy = ty - ly; float dist = sqrtf(dx * dx + dy * dy);
if (dist < shortestDist) shortestDist = dist;
}
{
// Calculate distance
//Vector2 targetVec(j - ((j / width) * width), j / width); //float dist = localVec.CalcDistance(targetVec);  float tx = j - ((j / width) * width); float ty = j / width;  float dx = tx - lx; float dy = ty - ly; float dist = sqrtf(dx * dx + dy * dy);
if (dist < shortestDist) shortestDist = dist;
}
dst[i] = (1 - spread01) *.5f;
}
}
116
edits

Navigation menu