Find the upper surface of a 3d object.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Casey Ricks
le 9 Sep 2020
Commenté : Casey Ricks
le 10 Sep 2020
As the title suggests, I would like to find the points that correlate only to the upper surface of a 3d object.
I have a matrix containing thousands of points (x,y,z coordinates). The shape is that of a slightly bent, rectangular plate. The coordinates pertain to a molecular structure, so the volume of the structure is filled with points.
I used following to approximate the the shape and then find the outer perimeter:
mymatrix; %mymatrix(:,1) corresponds to x coordinates, mymatrix(:,2) corresponds to y, and mymatrix(:,3) corresponds to z
%The following creates a bounding volume and provides xyz coordinates of that bounding volume
shp = alsphashape(x,y,z, 0.1);
[tri, xyz] = boundaryFacets(shp);
trisurf(tri,xyz(:,1),xyz(:,2),xyz(:,3), 'FaceColor','cyan','FaceAlpha',0.3) ; %This plots that outer perimeter and also yields the xyz matrix of that bounding box
I would like to extract the points correlating only to the upper surface of this matrix so that I can then later take the gradient of that surface.
I think I'm just missing something simple here. Any help is greatly appreciated.
0 commentaires
Réponse acceptée
Image Analyst
le 9 Sep 2020
Try using scatteredInterpolant() to get a z value for every combination of x and y. See attached demo.
3 commentaires
Image Analyst
le 10 Sep 2020
Modifié(e) : Image Analyst
le 10 Sep 2020
For some assortment of (x,y) locations, you have a value -- your z value. I assume that z is is the center of the atom so we now need to add the radius to it to get a new height to train the interpolant with.
This is just like the National Weather Service which has temperatures for a bunch of scattered cities, but not everywhere. Now you can turn that into a matrix where you DO have the value everywhere by using scatteredInterpolant. You have your x,y,height values, then you get the interpolant. Then you create a grid using meshgrid which will give you the coordinates for every possible (x,y) location - not just ones you have but ALL of them over your entire range of x and y. Then you just feed that into the interpolant to get the estimated height (z+radius) values everywhere. Not just at your training points, but everywhere in the possible range. This is how the NWS can turn a bunch of scattered temperatures for a limited number of discrete city locations into temperature values for anywhere in the country. Does that explain it better?
Plus de réponses (1)
Matt J
le 9 Sep 2020
Perhaps you can obtain the facet normals like in this example,
and classify any facet whose normal has a positive z-component as belonging to the upper surface.
0 commentaires
Voir également
Catégories
En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!