Created
January 6, 2012 20:15
-
-
Save shilrobot/1572210 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parallel.For(0, H, y => | |
{ | |
int j = y * 3 * W; | |
//for(; y<ymax; ++y) | |
{ | |
for (int x = 0; x < W; ++x) | |
{ | |
float a = max, | |
b = max, | |
c = max; | |
float t0, t1; | |
Vector2 xy = new Vector2(x, y); | |
for (int i = 0; i < N; ++i) | |
{ | |
float distSq; | |
Vector2.DistanceSquared(ref xy, ref pts[i], out distSq); | |
if (distSq < c) | |
{ | |
if (distSq < b) | |
{ | |
if (distSq < a) | |
{ | |
// Xab | |
t0 = a; t1 = b; | |
a = distSq; b = t0; c = t1; | |
} | |
else | |
{ | |
// aXb | |
t0 = a; t1 = b; | |
a = t0; b = distSq; c = t1; | |
} | |
} | |
else | |
{ | |
//abX | |
t0 = a; t1 = b; | |
a = t0; b = t1; c = distSq; | |
} | |
} | |
} | |
data[j++] = a; | |
data[j++] = b; | |
data[j++] = c; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment