0

是否有任何 C++ 库具有类似于 MatLab 等值面的功能?

这是我需要的示例:

clc
clear

n = 30;       

x = linspace(-125,125,n); 
y = linspace(-125,125,n); 
z = linspace(-260,25,n);

[X,Y,Z] = meshgrid(x,y,z);
[X2,Y2] = meshgrid(x,y);

quan=abs(3.15*exp(-(X2.^2+Y2.^2)/(2*(28.8)^2)));
Quan=repmat(quan,[1 1 n]);

P=-Z-10*Quan
pv=isosurface(X,Y,Z,P,0);

pa=patch(pv);
xi=pv.vertices(:,1);
yi=pv.vertices(:,2);
zi=pv.vertices(:,3);

[zn]=griddata(xi,yi,zi,X2,Y2);

surf(zn);
4

0 回答 0