[Pd] drawing a circle with data structures
Chuckk Hubbard
badmuthahubbard at gmail.com
Thu May 25 14:25:43 CEST 2006
This here is pretty close on a smaller circle, but here it is with
radius 200. This is close enough for my purposes. I know there are
reasons people would want drawcurve to curve around the points fed to
it, but for drawing a circle of a certain radius, it would be better
if it forced the curve to use those points. Unless I'm doing
something totally wrong.
-Chuckk
On 5/25/06, Frank Barknecht <fbar at footils.org> wrote:
> Hallo,
> Frank Barknecht hat gesagt: // Frank Barknecht wrote:
>
> > Anyways I attached a circle which is ripped from Miller's scaling
> > example. In its current form it uses features only available in
> > pd-0.39, however the basic approach works for older Pds as well. You
> > just draw a stopping sign, then let the curves of
> > drawcurve/filledcurve transform it into (almost?) a circle.
>
> I forgot to add: The numberbox labelled "radius" is not used to input
> the actual radius although with a different scaling it can be made
> to do so.
>
> For simplicity it is scaled by cos(360°/16) which is about 0.92, and
> sin(360°/16) (about 0.38), which explains the 38 and 92 inside the
> data structure definition.
>
> Ciao
> --
> Frank Barknecht _ ______footils.org_ __goto10.org__
>
-------------- next part --------------
#N canvas 731 262 454 304 12;
#N canvas 196 64 606 419 circle 0;
#X obj 30 37 struct circle float x float y float rad;
#X obj 83 339 drawpolygon 0 2 rad(0:1000)(0:-1000) 0 rad 0;
#X obj 10 98 drawcurve 90 1 rad 0 rad(0:1000)(0:924) rad(0:1000)(0:-383)
rad(0:1000)(0:707) rad(0:1000)(0:-707) rad(0:1000)(0:383) rad(0:1000)(0:-924)
0 rad(0:1000)(0:-1000) rad(0:1000)(0:-383) rad(0:1000)(0:-924) rad(0:1000)(0:-707)
rad(0:1000)(0:-707) rad(0:1000)(0:-924) rad(0:1000)(0:-383) rad(0:1000)(0:-1000)
0 rad(0:1000)(0:-924) rad(0:1000)(0:383) rad(0:1000)(0:-707) rad(0:1000)(0:707)
rad(0:1000)(0:-383) rad(0:1000)(0:924) 0 rad rad(0:1000)(0:383) rad(0:1000)(0:924)
rad(0:1000)(0:707) rad(0:1000)(0:707) rad(0:1000)(0:924) rad(0:1000)(0:383)
rad 0;
#X restore 81 197 pd circle;
#N canvas 14 78 643 619 show 1;
#X restore 71 251 pd show;
#X obj 280 172 pointer circle;
#X msg 255 122 traverse pd-show \, next;
#X obj 266 215 set circle rad;
#X floatatom 197 174 5 0 0 0 - - -;
#X obj 61 157 s pd-show;
#X msg 39 116 clear;
#X msg 151 71 scalar circle 300 300 200;
#X obj 151 35 loadbang;
#X connect 2 0 4 1;
#X connect 3 0 2 0;
#X connect 5 0 4 0;
#X connect 7 0 6 0;
#X connect 8 0 6 0;
#X connect 9 0 8 0;
More information about the Pd-list
mailing list