comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Circle drawing request.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Circle drawing request. [message #7981] Tue, 28 January 1997 00:00 Go to previous message
D.Kennedy is currently offline  D.Kennedy
Messages: 26
Registered: January 1997
Junior Member
This must be a FAQ - anyone got a good circle drawing sub-routine?
Input - x, y, radius
Output - [x,y] vectors for POLYFILL etc.

I have been using one (shown below) but I find it produces fine lines
shooting off to small y values from the left and right edges of each
circle. And my fiddling with it has made it worse I'm afraid.


FUNCTION CIRCLE, xcenter, ycenter, radius
; Emailed by Dfanning 27th Jan

step = (radius/24.0)
x = FLTARR(25)
y = FLTARR(25)

; Construct a circle

FOR j=0,24 DO BEGIN
x(j) = j*step
y(j) = SQRT(radius^2 - x(j)^2)
ENDFOR

x = [x, Reverse(x)]
y = [y, -Reverse(y)]
x = [-Reverse(x), x]
y = [y,y]

; Center the circle at the specified coordinates.

x = x + xcenter
y = y + ycenter

points = FLTARR(2, 100)
points(0,*) = x
points(1,*) = y
RETURN, points
END
--
David Kennedy, Dept. of Pure & Applied Physics, Queen's University of Belfast
Email: D.Kennedy@Queens-Belfast.ac.uk | URL: http://star.pst.qub.ac.uk/~dcjk/
Hi! I'm a .signature virus! Copy me into yours and join the fun!
[Message index]
 
Read Message
Read Message
Previous Topic: Shaded circles request.
Next Topic: Re: Colorbar query.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:19:17 PDT 2025

Total time taken to generate the page: 0.00369 seconds