Calculate dimensions