Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a large set of points that are close to manifold which I want to show in a ListPointPlot3D. Using part of the data set illustrates this

plot

plot

there are fewer data points in the middle.

But using all the data with

ListPointPlot3D[list[[2 ;; n]]]

results in

plot

Is there a better way to visualize this? Somehow something like 3d contour plot of the density.

share|improve this question
    
Please note that part of your question is missing. –  Sjoerd C. de Vries Dec 5 '12 at 22:49
    
I am really sorry –  warsaga Dec 5 '12 at 22:53
    
Have you tried ContourPlot3D‌​? –  soandos Dec 5 '12 at 23:03
    
yes as well as ListContourPlot –  warsaga Dec 5 '12 at 23:16
    
Although the title doesn't mention it, this seems to be about fitting a surface to a point list. If so, it's a possible duplicate of Construct a simple mesh or tetrahedral mesh from 3D image surface –  Jens Dec 5 '12 at 23:28

2 Answers 2

up vote 2 down vote accepted

If your point cloud is extremely "thick" you can create a RegionFunction. Here is a simple example using points in the cube from -1 to 1 in all directions.

pts = RandomReal[{-1, 1}, {10^5, 3}];

ListPointPlot3D[pts, BoxRatios -> 1]

enter image description here

Now create the function.

nf = Nearest[pts];

inRegion[pt : {_Real, _Real, _Real}, eps_Real] := 
 TrueQ[Norm[nf[pt, 1][[1]] - pt] < eps]

This will give an approximation to the boundary enclosing the region. We decide a point is "in" if it is within .04 of one of the points in the original list, else it is outside.

d = 1.5;
reg = RegionPlot3D[
  inRegion[{x, y, z}, .04], {x, -d, d}, {y, -d, d}, {z, -d, d}, 
  Mesh -> False, PlotPoints -> 40]

enter image description here

This code was gleefully cribbed from some work here (Also here)

share|improve this answer
    
Thank you very much for the help. The problem with this approach is that I have outliers, and they get a ball around them, too. I am trying to use the cluster function, but this does not seem to work. –  warsaga Dec 6 '12 at 0:31
    
Try it with Norm[nf[pt, 2][[2]] - pt]; that should force there to be at least two nearby points in order to be considered "inside". –  Daniel Lichtblau Dec 6 '12 at 0:33
    
that is good but terribly slow.. –  warsaga Dec 8 '12 at 17:01
    
I'm mildly surprised about the speed issue. Can you give details on how to produce a data set typical of the sort you encounter? –  Daniel Lichtblau Dec 8 '12 at 20:54

In addition to what @Daniel Lichtblau described, let me give you a further idea. It is not completely clear whether it really helps in your case since frome the statement

I have a large set of points that are close to manifold

I can only guess and an example data-set would have been better.

What I would try is to estimate the local density of points and to make a ContourPlot3D (or a RegionPlot3D) which shows you the boundary of certain density.

You could for instance (and this is the difference to Daniels approach) calculate the distances from a point x to the next, say 30 points and then calculate the Mean or Median distance. This gives you kind of an estimation how dense x is surrounded by points.

Example:

data = ExampleData[{"Geometry3D", "StanfordBunny"}, "VertexData"];
With[{nf = Nearest[data]},
 density[x : {__?NumericQ}] := Mean[Map[Norm[x - #] &, nf[x, 30]]]
 ];
RegionPlot3D[
 density[{x, y, z}] < .01, {x, -.15, .1}, {y, -.1, .1}, {z, 0, .2}, 
 BoxRatios -> Automatic, PlotPoints -> 40]

Mathematica graphics

share|improve this answer
    
I like that. Could be useful in situations where sample points are relatively sparse. What I did kinda falls flat in such areas. (Plus 1, as they say. Whoever "they" is.) –  Daniel Lichtblau Dec 6 '12 at 14:48
    
@DanielLichtblau Thanks but it's stolen or at least inspired by the Kernel density estimation. –  halirutan Dec 6 '12 at 17:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.