calculate the right shape