[SciPy-User] creating a 3D surface plot from collected data

David Baddeley david_baddeley@yahoo.com...
Tue Feb 16 15:16:10 CST 2010


As I see it, Gael's example doesn't do any smoothing - it just uses the triangulation to do the interpolation and get around the irregular sampling, and seems like quite a reasonable way to attack the problem. 

Correct me if I'm wrong, but as I read it you've got a number of x,y,z points which lie on the surface of a 3D volume, rather than on an essentially 2D 'rubber sheet'. In this case the 2D triangulation is not going to give you what you want, but you could apply the same principle and do a 3D triangularisation, which should give you triangles on the surface of your object. The problem is that it'll also give you triangles covering the surface of the entire convex hull and on the inside of the object, which you're somehow going to need to cull. This could be as simple as just culling everything which is larger than a certain cutoff. After this you're still left with the problem of displaying the triangles somehow (there's probably a patch function in matplotlib axes3d, and you're almost certain to be able to get triangles into mayavi.

I'm not sure if mayavi has 3D triangularisation, but there's a python wrapper around qhull which does. If you want to go this route I've got some code using qhull which does the triangularisation, large face culling, and internal face culling, as well as some very limited opengl code to draw the triangles. It's slow (practically limited to a couple of thousand points), poorly commented,  buggy, and somewhat application specific, but might be useful as a template to try and write something better. It's definitely not a ready solution, but drop me a line if you want to give it a try.

cheers,
David


----- Original Message ----
From: Rob Clewley <rob.clewley@gmail.com>
To: SciPy Users List <scipy-user@scipy.org>
Sent: Wed, 17 February, 2010 9:13:47 AM
Subject: Re: [SciPy-User] creating a 3D surface plot from collected data

Gael, maybe we misunderstand each other! My data is actually very
smooth, it's just that it's not aligned on a regular mesh already.
It's ordered temporally as a single curve that is wrapping itself
around a solid object's surface.

-Rob

On Tue, Feb 16, 2010 at 11:07 AM, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:
> On Tue, Feb 16, 2010 at 10:19:32AM -0500, Rob Clewley wrote:
>> I too have some data that has multiple z values in the x,y  domain.
>> Worse, my data is not remotely arranged in a proper grid as it is
>> temporal trajectory data from a 3D ODE that winds itself round and
>> round the surface, like a very carefully wrapped mummy. I.e., it
>> doesn't wrap back over itself.
>
>> I'm not familiar with 3D plotting techniques and trying to set up the
>> plot of my surface in mayavi or matplotlib is not working along the
>> lines of standard cookbook examples. I cannot find appropriate
>> information online on how to plot the surface if I can't run the
>> interpolator for data that's not a function of (x,y) and my data needs
>> "alignment".
>
> Would this example help:
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/example_surface_from_irregular_data.html
>
> Gaël
_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user



      


More information about the SciPy-User mailing list