So, I have an object, that I would like to find and express the shape of. It’s approximately a rectangular prism, but one side is curved convex in both dimensions. I can measure the thickness at any point, though of course a large number of measurements becomes cumbersome. For expressing the shape, I can give the z coordinate of the surface as an algebraic function of x and y, or I can make a triaxial ellipsoid or an arbitrarily-rotated rectangular prism, or a union and/or intersection of a reasonable number of such shapes (I’ve already concluded that I can’t do it with a single triaxial ellipsoid). I don’t expect to match the shape exactly, but I’d like to get as good an approximation as I can.
So, what sort of function or shape should I be trying to match it to, and at what points should I be measuring to use for the fit?
In case anyone is curious, the object is my phone, and I’d like to make a model of it in a 3d modeling program, to use as a template for making a 3d printed case or holder for it. Of course, if it were anything other than my phone, I could try capturing it using Autodesk ReMake or something similar… except that, with the phone itself, that’s not likely to work very well.
Why not let the 3d modeling program handle the mathematical details? You can start with a rectangular prism in a program like Blender, then subdivide the face in question into a coarse mesh which you can edit as a NURBS and/or subdivision surface. If it’s not accurate enough, you can always refine the mesh. Algebraically, the smooth surface is made up of polynomials patched together smoothly, but you don’t need to deal with that directly any more than the original surface designers did.
Granted, there is some voodoo involved in knowing the optimal number and placement of points to measure, but it will not hurt to use a regular grid and make a few extra measurements. A 3d scanning program would have similarly generated a point cloud.
I don’t know that this is something a human should have to manually do…
There’s software that can take a point cloud and give you a NURBS approximation: Point cloud to NURBS (just what Google found)
Call up a few local libraries and maker spaces and ask them if they have a 3D scanner; they’re surprisingly common these days because a lot of people do exactly what you want to do, 3D scan something and then either replicate it or make accessories for it. Once you turn that point cloud into a CAD file (or I bet the scanning software could do it automatically, if used in maker labs)… the rest should be straightforward.
If the shape has reflection symmetry about the center, I’d try some kind of separable function of the form
z(x,y) = A f(2x/a) f(2y/b)
where a is the total width in the x-direction, b is the width in the y-direction and the function f satisfies f(x) = f(-x), f(0) = 1, and f(1) = f(-1) = 0. The parameter A is then the total height of the bulge.
The easiest functions to fit are probably polynomials, which must be even polynomials to satisfy the symmetry constraint. The simplest one would be f(x) = 1 - x[sup]2[/sup], but that has no free parameters; once you know the height at the center, you’re done. If you want more control, you can measure a few more points along each centerline, add higher-order terms (still even) to each polynomial, and do a curve fit to the profile along each centerline.
You could also borrow someone else’s phone to take the pictures for Autodesk ReMake. Either/or.
Man, I’ve been out of practice for way too long, if I forgot about separable functions. Yeah, that probably should have been my first try.
And the modeling program I’m using is TinkerCad, which doesn’t allow for direct editing of vertices (well, in a sense it does, but it’s a real pain). Yeah, yeah, I know that I’m like the guy who uses nothing but MS Paint for image editing, and I probably should learn some more capable program, but you’d be amazed what you can trick TinkerCad into doing.
Even in the 1-d case, if you want to (manually or automatically) fit a curve through a bunch of known points, you would want to use a spline rather than a polynomial. I guarantee that is how those curves are drawn by the artist in the first place.