Help with scatteredInterpolant: masking and meshgrid alternatives

10 vues (au cours des 30 derniers jours)
Brian
Brian le 25 Nov 2014
Commenté : David Young le 26 Nov 2014
Hello, thanks for reading this,
I am asking about ways to view a 3D point cloud as surfaces. This is a follow up to an earlier question: what I have is a 4 column text file denoting a point cloud with one column denoting data that I use for color, and three column entries for x y and z coordinates.
Here is the code I used, to get an idea:
What I do right now (after looking online) is use scattered interpolation and apply the interpolation to a meshgrid, but there are problems with this approach. The problem is I am transitioning an irregular point cloud to a uniform mesh grid which I then surf to visualize. So, that being said, I can view a slice of the volume I have nicely, but the interpolation doesn't end at the boundaries of the volume: it goes to each end of the meshgrid I assign it to.
I was wondering: how can I create a similar meshgrid, but assign the surrounding region such that it isn't included when interpolating color? I think the problem arises when I try to create a meshgrid out of the interpolated data in line 23 of my code, and I think I can edit my code here to judge where to place NaN or actual data values, but I was wondering how I could do that properly.
I will attach a picture denoting what I mean as well.
Thanks for your advice.

Réponses (1)

David Young
David Young le 25 Nov 2014
A quick thought - would it help to switch off extrapolation? Use
F = scatteredInterpolant(X,Y,Z,C,'nearest','none');
  2 commentaires
Brian
Brian le 26 Nov 2014
This worked perfectly, thanks!
David Young
David Young le 26 Nov 2014
Oh good! You could accept the answer - flags up that it might be generally useful.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by