completed cosine distribution for a generic shape - just some adjustements to make