private void CalculateDistance(BoundingBoxUV bBox, int amount, ref double x, ref double y)
{
double xLength = (bBox.Max.U - bBox.Min.U) * (1 - TITLEBAR);
double yLength = (bBox.Max.V - bBox.Min.V);
//calculate appropriate rows numbers.
double result = Math.Sqrt(amount);
while (0 < (result - (int)result)) {
amount = amount + 1;
result = Math.Sqrt(amount);
}
m_rows = result;
double area = xLength * yLength / amount;
//calculate appropriate distance between the views.
if (bBox.Max.U > bBox.Max.V) {
x = Math.Sqrt(area / GOLDENSECTION);
y = GOLDENSECTION * x;
}
else {
y = Math.Sqrt(area / GOLDENSECTION);
x = GOLDENSECTION * y;
}
}