Take the 2-minute tour ×

Hi all,

Consider a cloud of points in 3D space (x,y,z). The data is well-behaved, once plotted the surface looks like some sort of spheroid. I assumed a form for the fitting function f(x,y,z) = c1 x^2 + c2 y^2 + c3 z^2 + c4 x^2y^2 + ..etc

The coefficients were obtained using a least squares approximation. My only problem is that the surface has some concave portions. Does anyone know how to express a constraint that would generate the coefficients (c1,c2, ...) but ensure convexity at all points?

Thanks a lot!


share|improve this question
It would help if you said how the points are being obtained and what the final result is needed for. (You seem to be assuming that it is a spheroid to start with so it is not surprising that you are getting a spheroid out!) –  Tim Porter Aug 24 '11 at 9:03
Did you intend those terms with total degree 4? (I had not noticed them when I made the earlier comment.) –  Tim Porter Aug 24 '11 at 9:06
Perhaps it would be better to fit to an equation representing a spheroid or ovoid or superellipsoid, rather than the generic $f(x,y,z)$ you are using. –  Joseph O'Rourke Aug 24 '11 at 16:00

2 Answers 2

For your apparent purpose, in dimension $n$ it is convenient to begin with a homogeneous polynomial of total degree $2n$ with all individual exponents even. Then, for translates and rotations, all sorts of lower degree and odd exponent terms may show up.

In $\mathbb R^2,$ a rounded version of an ordinary square is $$ A(x^4 + y^4) + B x^2 y^2 = 1.$$ The ordinary unit circle is $A=1, B = 2.$ Disjoint hyperbolas are $A=1, B=-2.$ A somewhat squared shape, indeed the $L^4$ "unit circle," is $A=1, B=0.$ An alternative to Piet Hein's "superellipse" is $A=1, B=1.$ Finally, a real analytic curve that passes through all 8 lattice points with $ |x| \leq 1,\; |y| \leq 1$ other than the origin itself is $A=1, B = -1,$ or $$ x^4 - x^2 y^2 + y^4 = 1.$$

At some point I wanted a smooth version of an ordinary cube in $\mathbb R^3,$ meaning that it passed through all 26 integer lattice points with $ |x| \leq 1,\; |y| \leq 1,\; |z| \leq 1$ other than the origin itself. I wrote $$ A( x^6 + y^6 + z^6) + B (y^4 z^2 + z^4 x^2 + x^4 y^2 + y^2 z^4 + z^2 x^4 + x^2 y^4) + C x^2 y^2 z^2 = 1.$$ To find $A,B,C$ it is only necessary to check the $(x,y,z)$ triples $(0,0,1),(0,1,1),(1,1,1),$ and evidently $A=1, B=-\frac{1}{2}, C=1$ works. so $$ ( x^6 + y^6 + z^6) - \frac{1}{2}(y^4 z^2 + z^4 x^2 + x^4 y^2 + y^2 z^4 + z^2 x^4 + x^2 y^4) + x^2 y^2 z^2 = 1$$ is a rounded cube. I recall graphing this in spherical coordinates with $\rho$ a function of $\theta, \phi.$ The trouble was that it is very flat near the axes, so without spherical coordinates many different patches were necessary. It is obvious that this is a star-shaped body around the origin, it needs just a little more work to confirm that it is compact.

share|improve this answer
Evidently the OP wants convexity for the surface. That can be done as well. –  Will Jagy Aug 24 '11 at 19:30

You should use an ellipsoid.

share|improve this answer

Your Answer


