internal int GetIndex(float x)
{
int minIndex = 0; //inclusive
int maxIndex = entries.Count; //exclusive
int index = 0;
while (maxIndex - minIndex > 0)
{
index = (maxIndex + minIndex) / 2;
if (entries.Elements[index].item.boundingBox.Min.X > x)
maxIndex = index;
else if (entries.Elements[index].item.boundingBox.Min.X < x)
minIndex = ++index;
else
break; //Found an equal value!
}
return index;
}