calculate diameter