Plot 3D surface that is not the graph of a function
Asked Answered
V

3

8

I have a 3D data set of a surface that is not a function graph. The data is just a bunch of points in 3D, and the only thing I could think of was to try scatter3 in Matlab. Surf will not work since the surface is not a function graph.

Using scatter3 gave a not so ideal result since there is no perspective/shading of any sort.

Any thoughts? It does not have to be Matlab, but that is my go-to source for plotting.

To get an idea of the type of surface I have, consider the four images: enter image description here

The first is a 3D contour plot, the second is a slice in a plane {z = 1.8} of the contour. My goal is to pick up all the red areas. I have a method to do this for each slice {z = k}. This is the 3rd plot, and I like what I see here a lot.

Iterating this over z give will give a surface, which is the 4th plot, which is a bit noisy (though I have ideas to reduce the noise...). If I plot just the black surface using scatter3 without the contour all I get is a black indistinguishable blob, but for every slice I get a smooth curve, and I have noticed that the curves vary pretty smoothly when I adjust z.

Some fine-tuning will give a much better 4th plot, but still, even if I get the 4th plot to have no noise at all, the result using scatter3 will be a black incomprehensible blob when plotted alone and not on top of the 3D contour. I would like to get a nice picture of the full surface that is not plotted on top of the 3D contour plot

In fact, just to compare and show how bad scatter3 is for surfaces, even if you had exact points on a sphere and used scatter3 the result would be a black blob, and wouldn't even look like a sphere

Can POV-Ray handle this? I've never used it...

Vick answered 21/8, 2012 at 8:59 Comment(3)
can you show the result of the scatter3? so we know what kind of data we're talking about here...Tripalmitin
@GuntherStruyf I can't do that right now...I am generating the data now and plotting as I go, and the program is still running...and, of course, PrintScrn does not work on the computer I'm at, so I can't send a screenshot of the current progress...I can add it in about an hour or so, I hope.Vick
I added a pictorial description.Vick
V
1

just wanted to follow up on this question. A quick nice way to do this in Matlab is the following:

Consider the function d(x, y, z) defined as the minimum distance from (x, y, z) to your data set. Make sure d(x, y, z) is defined on some grid that contains the data set you're trying to plot.

Then use isosurface to plot a (some) countour(s) of d(x, y, z). For me plotting the contour 0.1 of d(x, y ,z) was enough: Matlab will plot a nice looking surface of all points within a distance 0.1 of the data set with good lighting and all.

Vick answered 9/10, 2012 at 9:4 Comment(0)
R
4

If you have a triangulation of your points, you could consider using the trisurf function. I have used that before to generate closed surfaces that have no boundary (such as polyhedra and spheres). The downside is that you have to generate a triangulation of your points. This may not be ideal to your needs but it definitely an option.

EDIT: As @High Performance Mark suggests, you could try using delaunay to generate a triangulation in Matlab

Revisionist answered 21/8, 2012 at 9:7 Comment(9)
And, as you don't say, Matlab has functionality for 3D triangulation.Tarantula
@HighPerformanceMark yes I currently dont have access to matlab and wanted to wait until I could identify the names of the triangulation functions before posting them in the answer. The only one I recall from memory is delaunay.Revisionist
@Revisionist I have never tried to triangulate a set of 3D points. Can you point me to methods of doing this?Vick
From the documentation delaunay is probably the only one OP needs, certainly a good choice to start from.Tarantula
Delaunay in the (x,y) domain (then using trisurf) cannot solve the problem if the points do not represent a single valued function. delaunayn of the 3-d domain will not solve the problem either, UNLESS the set represents a convex object, in which case convhulln is appropriate anyway since only the surface is needed. And since the asker has never mentioned convexity of the point cloud as an attribute, I'd not assume that as fact.Jupiter
I recall that there was an algorithm that went by the name of alpha hull that could be used to generate something like a skin for a surface of points. I doubt that matlab has something like that built internally though.Revisionist
@Revisionist - an alpha shape can SOMETIMES work here. An alpha shape produces something akin to a delaunay triangulation, but need not be convex. The boundary surface or hull of that shape would be termed the alpha hull. IF the scattered set populates the entire surface with a fairly uniform density, then an alpha shape can work, as long as there are no sharp internal corners to find. Perhaps more consistently good for this purpose than an alpha shape is the CRUST algorithm.Jupiter
Thank you for all of your suggestions! I got caught up with lunch and a meeting, and now I'm home away from the office, but I will definitely look into this soon.Vick
I added some pictures in my original post to show you what I'm computing.Vick
V
1

just wanted to follow up on this question. A quick nice way to do this in Matlab is the following:

Consider the function d(x, y, z) defined as the minimum distance from (x, y, z) to your data set. Make sure d(x, y, z) is defined on some grid that contains the data set you're trying to plot.

Then use isosurface to plot a (some) countour(s) of d(x, y, z). For me plotting the contour 0.1 of d(x, y ,z) was enough: Matlab will plot a nice looking surface of all points within a distance 0.1 of the data set with good lighting and all.

Vick answered 9/10, 2012 at 9:4 Comment(0)
I
0

In povray, a blob object could be used to display a very dense collection of points, if you make them centers of spheres.
http://www.povray.org/documentation/view/3.6.1/71/ If you want to be able to make slices of "space" and have them colored as per your data, then maybe the object pattern (based on a #declared blob object) might do the trick.

Povray also has a way to work with df3 files, which I've never worked with, but this user appears to have done something similar to your visualization. http://paulbourke.net/miscellaneous/df3/

Irra answered 25/9, 2012 at 13:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.