calculate shape in a util function