scaleDimension method
Scale so that specified dimension matches specified value.
Implementation
void scaleDimension(Axis axis, double s)
{
double currentAspectRatio = aspectRatio();
switch (axis)
{
case Axis.X:
width = s;
height = (1 / currentAspectRatio) * s;
break;
case Axis.Y:
height = s;
width = currentAspectRatio * s;
break;
default:
throw new IllegalArgumentException("Bad axis argument.");
}
}