在MATLAB中,求(规则)曲面的法线的函数是:surfnorm(X,Y,Z),那有没有求非规则trisurf()曲面的法线的函数呢,或者提供一种比较好的求法线的方法。
还有trisurf(tri,X,Y,Z);函数中tri的矩阵大小为M*3,M的大小为多少?(因为我要在VC中调用trisurf(tri,X,Y,Z);必须定义tri的大小)

解决方案 »

  1.   

    我帮你查了reference,没有看到M大小的限制。你根据你实际需要设定吧。MATLAB Function Reference  trisurf Triangular surface plot Syntaxtrisurf(Tri,X,Y,Z)
    trisurf(Tri,X,Y,Z,C)
    trisurf(...'PropertyName',PropertyValue...)
    h = trisurf(...)Descriptiontrisurf(Tri,X,Y,Z) displays triangles defined in the m-by-3 face matrix Tri as a surface. 
    Each row of Tri defines a single triangular face by indexing into the vectors or matrices that contain the X, Y, and Z vertices. trisurf(Tri,X,Y,Z,C) specifies color defined by C in the same manner as the surf function. MATLAB performs a linear transformation on this data to obtain colors from the current colormap. trisurf(...'PropertyName',PropertyValue...) specifies additional patch property names and values for the patch graphics object created by the function. h = trisurf(...) returns a patch handle. Example
    Create vertex vectors and a face matrix, then create a triangular surface plot. x = rand(1,50);
    y = rand(1,50);
    z = peaks(6*x-3,6*x-3);
    tri = delaunay(x,y);
    trisurf(tri,x,y,z)