Avoid recomputing geometry in an inner loop