From: Ben Toomer on 6 Aug 2010 04:03 I am trying to use the fill command to shade areas of a spoke wheel pattern according to a function that I choose. I am using the fill command and specifying the vertices however MATLAB chooses to shade across the spoke horizontally and not perpendicularly as I would like so as to achieve shading that varied with radius. Is there something similar for Cdata as there is for lighting normals in this language?
From: Ross W on 13 Aug 2010 07:06 "Ben Toomer" <bt07(a)ic.ac.uk> wrote in message <i3gfjp$b8v$1(a)fred.mathworks.com>... > I am trying to use the fill command to shade areas of a spoke wheel pattern according to a function that I choose. I am using the fill command and specifying the vertices however MATLAB chooses to shade across the spoke horizontally and not perpendicularly as I would like so as to achieve shading that varied with radius. > > Is there something similar for Cdata as there is for lighting normals in this language? hi if i understand you correctly, then you can control the shading, and matlab has no preferred direction. here are two long thin triangles: one has radial shading and one has vertical shading. fill([0 0 1 0],[0 1 5 0],[1 1 2 1]) hold on fill([0 0 1 0],[1 2 5 1],[1 2 1 1]) the numbers in [1 1 2 1] indicate the colour at each corner of the patch Ross
From: Ben Toomer on 13 Aug 2010 08:21 Thanks, Ross. I have a similar triangular spoke to this one and is composed of 300 vertices, 100 for each of the straight edges. When I define just a single vertex to have shading, I cannot control the direction into which the color is filled. Perhaps you also have a similar problem?
From: Ben Toomer on 13 Aug 2010 08:28 Further to the last post, this code illustrates my problem. X = [linspace(0,1,50) linspace(1,0,50)]; Y = [linspace(0,5,50) linspace(5,1,50)]; color = zeros(1,100); color(10) = 1; fill(X,Y,color); You see the preference to fill in the X direction? Thanks again. Ben
|
Pages: 1 Prev: Help me in SVM classify Next: fittype with function handle / anonymous function |