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

Rob Clewley rob.clewley at gmail.com
Tue Feb 16 18:13:23 EST 2010


Yes, David, definitely a 3D surface, so we'll need 3D
triangularisation. I think by culling you are referring to removing
giant triangles that would cover the opening of the "horn" shape that
I know my data makes, because those triangles would be part of the
convex hull. If so, we can certainly cutoff by size. When you say
other triangles that are "inside" do you just mean the ones on the
surface of the horn's opening that are not on the convex hull? If we
get as far as a clean triangularisation then we will plot with mayavi.

So I guess I will try using Delauney3D. Thanks for the tips. I (or
rather my student who is doing this mostly) will look into this more
closely to see if we can leverage these examples more than previous
ones. I'll be back on this thread if I get stuck, so look out :)

Thanks,
Rob

On Tue, Feb 16, 2010 at 4:16 PM, David Baddeley
<david_baddeley at yahoo.com.au> wrote:
> 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 at gmail.com>
> To: SciPy Users List <scipy-user at 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 at 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



More information about the SciPy-User mailing list