From: Enrico on
I need to draw a solid circle except the fill needs to be random weighted towards the center.

I am currently doing the following:

center = round(radius);
cvs = zeros(2*center,2*center);
cvs(center+1,center+1)=10^(color/10);
for az=0:1/(2*radius):2*pi
for r=1:center
x=round(center+sin(az)*r);
y=round(center+cos(az)*r);
cvs(y+1,x+1)=10^(color/10*rand()*(center-r-1)/(center-1));
end
end

However this method is rather slow.
Is there a faster way I can do this?

I'd appreciate any suggestions.
From: someone on
"Enrico " <en(a)rcsnetwork.com> wrote in message <i1fsp0$anu$1(a)fred.mathworks.com>...
> I need to draw a solid circle except the fill needs to be random weighted towards the center.
>
> I am currently doing the following:
>
> center = round(radius);
> cvs = zeros(2*center,2*center);
> cvs(center+1,center+1)=10^(color/10);
> for az=0:1/(2*radius):2*pi
> for r=1:center
> x=round(center+sin(az)*r);
> y=round(center+cos(az)*r);
> cvs(y+1,x+1)=10^(color/10*rand()*(center-r-1)/(center-1));
> end
> end
>
> However this method is rather slow.
> Is there a faster way I can do this?
>
> I'd appreciate any suggestions.

I'm not sure exactly what your code is doing.
But, a quick way to draw a solid circle is to use the
RECTANGLE command with the Curvature option.

doc rectangle

See the last example.

If you need "weighted" colors, perhaps you could "overlay"
different size "rectangles" with different colors.

Something like:

rectangle('Position',[1,2,5,10],'Curvature',[1,1],...
'FaceColor','r')
daspect([1,1,1])
xlim([0,7])
ylim([1,13])
hold on
rectangle('Position',[2,4,3,6],'Curvature',[1,1],...
'FaceColor','y')
From: Enrico on
"Enrico " <en(a)rcsnetwork.com> wrote in message <i1fsp0$anu$1(a)fred.mathworks.com>...
> I need to draw a solid circle except the fill needs to be random weighted towards the center.
>
> I am currently doing the following:
>
> center = round(radius);
> cvs = zeros(2*center,2*center);
> cvs(center+1,center+1)=10^(color/10);
> for az=0:1/(2*radius):2*pi
> for r=1:center
> x=round(center+sin(az)*r);
> y=round(center+cos(az)*r);
> cvs(y+1,x+1)=10^(color/10*rand()*(center-r-1)/(center-1));
> end
> end
>
> However this method is rather slow.
> Is there a faster way I can do this?
>
> I'd appreciate any suggestions.

Quick explanation.

It draws several lines going from the center to the edge until it gets all the way around. ofcourse there is alot of overlap here.
From: Matt Fig on
"Enrico " <en(a)rcsnetwork.com> wrote in message
> > I am currently doing the following:
> >
> > center = round(radius);
> > cvs = zeros(2*center,2*center);
> > cvs(center+1,center+1)=10^(color/10);
> > for az=0:1/(2*radius):2*pi
> > for r=1:center
> > x=round(center+sin(az)*r);
> > y=round(center+cos(az)*r);
> > cvs(y+1,x+1)=10^(color/10*rand()*(center-r-1)/(center-1));
> > end
> > end
> Quick explanation.
>
> It draws several lines going from the center to the edge until it gets all the way around. ofcourse there is alot of overlap here.


Except that your code does *not* draw anything. All I see is some calculations being done. I see no calls to PLOT, LINE or any other graphics function.
From: Enrico on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <i1g05o$m9i$1(a)fred.mathworks.com>...
> "Enrico " <en(a)rcsnetwork.com> wrote in message
> > > I am currently doing the following:
> > >
> > > center = round(radius);
> > > cvs = zeros(2*center,2*center);
> > > cvs(center+1,center+1)=10^(color/10);
> > > for az=0:1/(2*radius):2*pi
> > > for r=1:center
> > > x=round(center+sin(az)*r);
> > > y=round(center+cos(az)*r);
> > > cvs(y+1,x+1)=10^(color/10*rand()*(center-r-1)/(center-1));
> > > end
> > > end
> > Quick explanation.
> >
> > It draws several lines going from the center to the edge until it gets all the way around. ofcourse there is alot of overlap here.
>
>
> Except that your code does *not* draw anything. All I see is some calculations being done. I see no calls to PLOT, LINE or any other graphics function.

It "draws" it to "cvs"
imagesc(cvs) would display it.

I'm drawing something more complex, this was just a portion of it.
I'm really just looking for a better circle algorithm. I could do a simple scan algorithm that could draw and fill the circle very fast, but because of this center weighting, the only way i could think of doing it was to draw lines from the center.