四面体可视化 Octave

发布于 2024-12-07 11:02:23 字数 379 浏览 1 评论 0原文

大家好,有谁知道如何在 Octave 中可视化 delaunay3() 函数的输出中的四面体吗?

http://www.obihiro.ac.jp/~suzukim /masuda/octave/html3/octave_151.html

在 MATLAB 中,此可视化是使用 tetramesh() 函数完成的,但 Octave没有内置这个功能!

该链接确实提到了 Triplot 和 Trimesh 函数,但它们只创建三角形,而不是四面体。

Hi does anyone know how to visualize the tetrahedrons in the output of the delaunay3() function in Octave?

http://www.obihiro.ac.jp/~suzukim/masuda/octave/html3/octave_151.html

In MATLAB this visualization is done with the tetramesh() function but Octave does not have this function built in!

The link does mention the triplot and trimesh functions but they only create triangles, not tetrahedra.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洛阳烟雨空心柳 2024-12-14 11:02:23

不幸的是,我对此了解不够,无法对此发表任何想法。但是,我想提一下以下内容,以防您以前没有看过。 之前有过关于 tetramesh 的讨论martin_helm 编写了一个快速解决方案:

function tetramesh( T, X, C)
  if nargin < 3
     C = mod((1:size(T, 1))'-1, size(colormap(), 1) + 1);
  endif
  triang = [T(:, 1) T(:, 2) T(:, 3); ...
            T(:, 2) T(:, 3) T(:, 4); ...
            T(:, 3) T(:, 4) T(:, 1); ...
            T(:, 4) T(:, 1) T(:, 2)];
  patch("Faces", triang, "Vertices", X, "FaceVertexCData", [C; C; C; C])
endfunction 

以及一些示例用法:

backend("fltk") % backend("gnuplot") could also be used
d = [-1 1];
[x,y,z] = meshgrid(d,d,d);
x = [x(:);0];
y = [y(:);0];
z = [z(:);0];

tetra = delaunay3(x,y,z);
X = [x(:) y(:) z(:)];
tetramesh(tetra, X)
view(30,30) 

Unfortunately, I don't know enough about this to give any thoughts on it. But, I would like to mention the following, in case you hadn't seen it before. There have been discussions on tetramesh before. A quick solution was written up by martin_helm:

function tetramesh( T, X, C)
  if nargin < 3
     C = mod((1:size(T, 1))'-1, size(colormap(), 1) + 1);
  endif
  triang = [T(:, 1) T(:, 2) T(:, 3); ...
            T(:, 2) T(:, 3) T(:, 4); ...
            T(:, 3) T(:, 4) T(:, 1); ...
            T(:, 4) T(:, 1) T(:, 2)];
  patch("Faces", triang, "Vertices", X, "FaceVertexCData", [C; C; C; C])
endfunction 

Along with some example usage:

backend("fltk") % backend("gnuplot") could also be used
d = [-1 1];
[x,y,z] = meshgrid(d,d,d);
x = [x(:);0];
y = [y(:);0];
z = [z(:);0];

tetra = delaunay3(x,y,z);
X = [x(:) y(:) z(:)];
tetramesh(tetra, X)
view(30,30) 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文