trisurf to surf

6 次查看(过去 30 天)
Sven Koerner
Sven Koerner 2011-2-24
编辑: DGM 2025-7-5
Hi, does anyone know a calculation for converting data from trisurf-plots in surf-plots?
If there is data TRI,X,Y and Z for generating a trisurf plot ( trisurf(Tri,X,Y,Z)), how can I convert the data to Xnew, Ynew and Znew, so that I get the same figure as with trisurf-function while doing surf(Xnew, Ynew, Znew)?
  1 个评论
Pavel Kolesnichenko
编辑:Pavel Kolesnichenko 2019-7-3
I have similar question: is there a way to extract X,Y,Z-values from 'trisurf'-plot in the format that would be suitable to feed into 'surf'-command.

请先登录,再进行评论。

回答(2 个)

Sulaymon Eshkabilov
Here is a nice code developed by a matlab community user:
A few codes on surf and trisurf plotting options:
https://stackoverflow.com/questions/9170838/surface-plots-in-matplotlib
  1 个评论
DGM
DGM 2025-7-5
编辑:DGM 2025-7-5
FEX surf2stl() is the opposite of what's needed. It takes simple gridded data compatible with surf() and triangulates it. We have triangulated data and want to turn it into gridded data compatible with surf.
The SO thread is about plotting (what we can assume is) scattered XYZ data as a surface -- basically an application where one would use griddata() (or if it's reshape() if it's actually gridded), but in python instead of MATLAB.

请先登录,再进行评论。


DGM
DGM 2025-7-5
编辑:DGM 2025-7-5
The surf() tool works on gridded data. There's no reason to assume that triangulated F,V data is constrained to a grid. Is there an easy, convenient, and universally-applicable way to transform any arbitrary triangulation into gridded data? Not that I know of. For some simple cases, you might be able to use griddata(), but I'm not sure how you would apply that to any arbitrary geometry without complications or risking loss of fidelity.
For example, how would we reduce this triangulation to a concise gridded representation? It's not a single-valued function in any direction. It has holes, nonuniform resolution, and it consists of multiple connected components. I don't know how I would.
I think the better question is why you need to reduce the more descriptive F,V data into gridded data just to be able to use surf(). Given that this was in 2011, if the goal were to try to cram everything into gridded format in order to feed it to surf2stl(), then there was never any need. FEX #20922 has existed since 2008, and could take the F,V data directly without needing to grid it and then retriangulate it all over again for no benefit. Since R2018b, MATLAB has had stlwrite() in the base toolbox, so you don't even need #20922.
If there's some other goal, then I can only guess as to the goals and the shape of the triangulated data.

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by