Forum: Poser Technical


Subject: Surface-fitting interpolating algorithm needed.

Anthony Appleyard opened this issue on Oct 21, 2004 ยท 7 posts


Anthony Appleyard posted Thu, 21 October 2004 at 6:04 AM

If I know the coordinates of (say) all the vertexes of a face F and all the vertexes of all adjacent faces, please what is a quick way to find the coordinates of another point that is on a curved surface drawn through all those vertexes? Say: I rotate the coodinate axes so that face F is flat in the XY plane; if I need a point {x,y,z} which is on a surface drawn through all those vertexes, and I know x and y, how to quickly find z?


mateo_sancarlos posted Thu, 21 October 2004 at 4:40 PM

I believe one of them is called bicubic interpolation, where 4 points define a cubic curve (ax^3+bx^2+cx+d=0).


Anthony Appleyard posted Fri, 22 October 2004 at 12:41 AM

I know about fitting cubic splines to a set of 2D points {xI,yI} for I = 1 to n: Sort the points into order of increasing x. Fit cubic to points A B C D. Let that be the curve from A to C. Work out that curve's slope (= differential coefficient) at C. Use that slope and yC yD yE to fit a curve to C D E. That is the 2nd spline. Work out the slope at D. Use that slope and yD yE yF ... etc etc. The last spline is applied between x[n-2] and x[n]. This method avoid slope discontinuities (= kinks) where splines join. I have programmed this method in my MAKEOBJ and it works.

But I need a method for THREE dimensions: given a set of points {xI, yI, zI} for I = 1 to n: fild z for some given value of {x,y}. I could divide the {x,y} area into polygons (if the coordinates are a 3D mesh, that has already been done). Then fit a spline within each polygon. But how to avoid creases in the 3D curve at the {x,y} polygon boundaries? As it is 3D, I can't merely run from one end to the other.

Message edited on: 10/22/2004 00:45


mateo_sancarlos posted Fri, 22 October 2004 at 9:03 PM

The projection of the cubic 3D curve on each plane is still a cubic curve, so just solve all three equations and interpolate: (a1x^3+b1x^2+c1x+d1=0) (a2y^3+b2y^2+c2y+d2=0) (a3z^3+b3z^2+c3z+d3=0) But there are probably hundreds of interpolation algorithms.


Valandar posted Sat, 23 October 2004 at 2:12 AM

Guys, this is possibly the most TECHNICAL of technical questions I have seen to date... ^_^

Remember, kids! Napalm is Nature's Toothpaste!


Anthony Appleyard posted Sat, 23 October 2004 at 2:55 AM

The projection of the cubic 3D fitted surface on each plane (XY, YZ, ZX) is an area, not a curve. In many 3D meshes the vertexes are irregularly scattered about, not in rank and file e.g. along X and Y, so I can't 2D fit e.g. in X and then in Y.

Message edited on: 10/23/2004 02:59


Maz posted Sat, 23 October 2004 at 11:21 AM

Do you really need to be that accurate? Poser's rendering engine smooths corners out anyway, so things will usually look better than they are. Unless I misunderstand what you're trying do do an approximation might be good enough. You say that you know the x and y for this new point but need the z. I assume that you are creating a new vertex so that you can get a higher resolution mesh. Incidentally, somebody else has already done a util that does this. Unfortunately I can't remember what it is called. I'll post again if I remember. How about just averaging the z of all the vertices in face F? It won't be far out and it's certainly an easy algorithm. I can't imagine a situation where that would cause a noticeable crease or other artifact.