Graphics Programs Reference
In-Depth Information
fac2=[126
163
146
1 6 5];
The resulting display is now rendered correctly no matter what the view-
ing angle:
clf
patch('vertices',vert2,...
'faces',fac2,'facecolor','y')
view(3),grid,xyz
1
0
−1
1
0
0.5
−1
0
y
x
Patch Colouring
Simple solid colouring of patches can be specified using the named
colours, as we did for the yellow ( 'y' ) patches of the previous section.
You can also use arbitrary RGB colours. Here is a patch that should be
orange on your display:
xt = [0 1 .5];
yt=[001];
clf
h = patch(xt,yt,[1 .4 0])
1
0.5
0
0
0.5
1
Patches have a number of properties that control how they are coloured.
By using coloured patches, you can make pictures of objects that are
colour-coded to some quantity you want to display. For example, the
stress of a bent bar could be presented as the colour of the bar. Here is a
list of patch colour properties and a description of what they do (taken
from the Using MATLAB Graphics manual).
CData Specify single, per face, or per vertex colours in conjunction with
x , y , and z data.
CDataMapping Specifies whether colour data is scaled or used directly
as indices into the Figure colormap.
FaceVertexCData Specify single, per face, or per vertex colours in con-
junction with faces and vertices data.
EdgeColor Edges can be invisible, a single colour, a flat colour deter-
mined by vertex colours, or interpolated colours determined by
vertex colours.
FaceColor Faces can be invisible, a single colour, a flat colour deter-
mined by vertex colours, or interpolated colours determined by
vertex colours.
Search WWH ::




Custom Search