COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### 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

```"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.

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

```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

```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

3 Replies
389 Views

Similiar Articles:

7/21/2012 2:41:05 AM