Fill Command?

  • Follow


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?
0
Reply Ben 8/6/2010 8:03:05 AM

"Ben Toomer" <bt07@ic.ac.uk> wrote in message <i3gfjp$b8v$1@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
 
0
Reply Ross 8/13/2010 11:06:08 AM


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?
0
Reply Ben 8/13/2010 12:21:04 PM

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
0
Reply Ben 8/13/2010 12:28:09 PM

3 Replies
389 Views

(page loaded in 0.03 seconds)

Similiar Articles:













7/21/2012 2:41:05 AM


Reply: