嗨,有人知道如何delaunay3()
在 Octave 函数的输出中可视化四面体吗?
http://www.obihiro.ac.jp/~suzukim/masuda/octave/html3/octave_151.html
在 MATLAB 中,这个可视化是用tetramesh()
函数完成的,但 Octave 没有内置这个函数!
该链接确实提到了triplot
andtrimesh
函数,但它们只创建三角形,而不是四面体。
嗨,有人知道如何delaunay3()
在 Octave 函数的输出中可视化四面体吗?
http://www.obihiro.ac.jp/~suzukim/masuda/octave/html3/octave_151.html
在 MATLAB 中,这个可视化是用tetramesh()
函数完成的,但 Octave 没有内置这个函数!
该链接确实提到了triplot
andtrimesh
函数,但它们只创建三角形,而不是四面体。
不幸的是,我对此知之甚少,无法对此发表任何想法。但是,我想提一下以下内容,以防您以前没有看过。之前也有过关于 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)