当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


MATLAB fill3()用法及代码示例


fill3 函数创建 flat-shaded 和 Gouraud-shaded 多边形。

用法

fill3(X, Y, Z, C) // It fills three-dimensional polygon. X, Y, and Z triplets specify a polygon vertices. If X, Y, or Z is a matrix, fill3 develop n polygons, where n is a number of columns in the matrix. fill3 close the polygons by linking the last vertex to the first when necessary.
C specifies color, where C is the vector or matrix of indices into the current colormap. If C is the row vector, length(C) must same size(X, 2) and size(Y, 2); if C is the column vector, length(C) must same size(X, 1) and size(Y, 1).
fill3(X, Y, Z, ColorSpec) // It fills three-dimensional polygons defined by X, Y, and Z with color specified by ColorSpec.
fill3(X1,Y1,Z1,C1,X2,Y2,Z2,C2,...) // It specifies multiple filled three-dimensional areas.
fill3(...,'PropertyName',PropertyValue) // It allows us to set values for specific patch properties.
h = fill3(...) // It returns a vector of handles to patch graphics objects, one handle per patch.

示例

绘制四个填充的多边形,每个多边形具有三个顶点。

X= [0 0 0 0; 1 1 -1 1; 1 -1 -1 -1];
Y= [0 0 0 0; 4 4 4 4; 4 4 4 4];
Z= [0 0 0 0; 1 1 -1 -1; -1 1 1 -1];
fillcolor= rand(3, 4);
fill3 (X, Y, Z, fillcolor)
view (120, 30)

输出:

MATLAB fill3()



相关用法


注:本文由纯净天空筛选整理自 MATLAB fill3()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。