Before revision:  This algorithm also works for other shapes ( such as rectangles)and in any fixed dimension.
After revision:  This algorithm also works for other shapes ( e.g., rectangles), and it works in any fixed dimension.