Skip to content

Instantly share code, notes, and snippets.

@greenboxal
Created February 13, 2013 02:59
Show Gist options
  • Save greenboxal/4941926 to your computer and use it in GitHub Desktop.
Save greenboxal/4941926 to your computer and use it in GitHub Desktop.
private bool CheckThreshold(Vector4[] colors)
{
int i;
Vector4 a = new Vector4();
Vector4 min = new Vector4();
Vector4 max = new Vector4();
for (i = 0; i < colors.Length; i++)
{
Vector4 c = colors[i];
Vector4.Min(ref min, ref c, out min);
Vector4.Max(ref max, ref c, out max);
a += colors[i];
i++;
}
a /= i;
return (a - _nodeThreshold) >= min && (a + _nodeThreshold) <= max;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment