How to generating surface without plotting?

21 ビュー (過去 30 日間)
Daniel Chou
Daniel Chou 2020 年 12 月 30 日
コメント済み: Daniel Chou 2020 年 12 月 30 日
I wonder if it's possible to create a surface by ''surf'' without plotting?
That means, I only want the surface data, but I don't want the figure.
Anyone has idea?
Thanks a lot and happy new year :)
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 12 月 30 日
Can you explain what surface data are you referring to?
Daniel Chou
Daniel Chou 2020 年 12 月 30 日
編集済み: Daniel Chou 2020 年 12 月 30 日
Sure!
For instance,
I would like to generate a surface of ellipsoid by
[x, y, z] = ellipsoid(3,3,5,1,0.5,0.5)
s=surf(x,y,z)
direction = [rand() rand() rand()];
rotate(s,direction,rand()*360)
Then use this surface to do further things
The plot of ellipsoid will be generated when I use ''surf'' command.
I just wanna know if it's possible to purely generate surface by surf without plotting it!
Thanks a lot!

サインインしてコメントする。

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 12 月 30 日
Since it is a graphical object, you cannot create it without plotting somewhere. However, you can make the figure invisible so that it does not appear on screen
[x, y, z] = ellipsoid(3,3,5,1,0.5,0.5)
f = figure('Visible', 'off');
ax = axes(f);
s = surf(ax,x,y,z)
direction = [rand() rand() rand()];
rotate(s,direction,rand()*360)
  1 件のコメント
Daniel Chou
Daniel Chou 2020 年 12 月 30 日
I'll try this later.
Thanks for your patience and replying
Happy new year as well :)
Sincerely
Daniel

サインインしてコメントする。

その他の回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 12 月 30 日
If I look at the first example on the surf documentation page, it first creates X, Y and Z, then uses surf to plot/create the surface. So is what you want X,Y and Z?
% Example modified to create surface data but not the surface
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
% surf(X,Y,Z)
  1 件のコメント
Daniel Chou
Daniel Chou 2020 年 12 月 30 日
Thanks for response
Actually I'm currently design a code to generate the ellipsoid inclusions in given space.
I try the build-in function of AlphaShape to detect overlapping, if the current ellipsoids are too close to each other, the current ellipsoid will be replaced by a new ellipsoid.
However, since I use the ''surf'' function to convert the ellipsoid [x,y,z] in to surface, the plot (from surf command) will be retained.
The output figure will look like a disaster.
Sincerely and happy new year!
Daniel

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by