Given an n-dimensional polytope $P$ in $\mathbb R^n$, Given as a convex hull of a finite set of points, $S$ I would like to construct an expliict formula for a function $f\colon \mathbb R^n \to \mathbb R$ such that $P=\left\{x\in\mathbb R^n \Big|\ f(x) \le 1\right\}$ Is there any nice known closed formula? It seems that there should be one in existance, as everything is piecewise linear.

Moreover, I would like to ask the same question in the case P is given as intersections of half planes (hence, the data I have are normal vectors to the plane and distance from the origin)

Thanks