[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Vectorising circle drawing
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: Vectorising circle drawing |
Date: |
Mon, 21 Apr 2008 13:14:31 -0500 |
On 21/04/2008, address@hidden <address@hidden> wrote:
> I have a matrix 'cr' where each row contains the center and radius
> of a circle. Now, I want to draw these circles in a image.
Do you need to draw the interior of the circles? Are you tight on
memory? How about this idea, using repmat?
cr = rand(2,10); #Row 1 is centres of circles, row is their radii.
t = linspace(0,2*pi,100)';
t = repmat(t,[1,columns(cr)]);
c = repmat(cr(1,:),[rows(t),1]);
r = repmat(cr(2,:),[rows(t),1]);
circsx = r.*cos(t) + c;
circsy = r.*sin(t) + c;
plot(circsx,circsy);
This plots about 1000 circles on my machine in under three seconds
(dual-core Intel thingie).
Good?
- Jordi G. H.