[PD] Data structures - drawing curves/circles

an polarity an_polarity at tiscali.co.uk
Sat May 6 13:54:26 CEST 2006


I am playing around with curves drawn with data structures, I want to 
move the 'control points' of curves around with my mouse but I notice a 
curve is not defined by points on the curve but by an invisible bounding 
box (which also defines any adjustments). If I will be using a lot of 
curves it will mean also drawing lots of bounding boxes so I can find 
where to click/drag.

(My patch should clarify what I mean)

Is there a different way to draw a curve that has control points always 
on the curve?

Why is a bounding box more useful to define a curve? (is it)?

Is there a simple way of defining a 'good' circle (with few points)?

TIA

dscurves.pd:

#N canvas 199 89 883 407 10;
#N canvas 464 633 536 274 curve-template 0;
#X obj 29 199 drawpolygon 0 3 -100 100 -100 -100 100 -100 100 100 -100
100;
#X obj 42 177 drawcurve 0 1 -100 100 -100 -100 100 -100 100 100 -100
100;
#X obj 44 45 struct curve-template float x float y float w;
#X obj 44 74 drawcurve 50 3 0 -100 w 0 0 100 -100 0 0 -100;
#X obj 60 110 drawcurve 900 1 0 -100 w 0 0 100 -100 0 0 0;
#X obj 46 129 drawpolygon 900 1 0 -100 w 0 0 100 -100 0 0 0;
#X text 44 90 green circle;
#X text 29 219 black circle/box;
#X text 45 145 red curve/box;
#X restore 24 23 pd curve-template;
#N canvas 140 160 314 266 curve-data 0;
#X coords -200 -125 200 125 400 250 1;
#X restore 25 47 pd curve-data;
#X floatatom 463 164 5 0 0 0 - - -;
#X obj 463 253 set curve-template w;
#X obj 643 208 pointer;
#X msg 643 187 traverse pd-curve-data \, bang;
#X obj 598 231 append curve-template x y w;
#X obj 598 165 t b b;
#X msg 598 209 0 0 0;
#X msg 461 139 bang;
#X msg 461 103 \; pd-curve-data clear;
#X text 304 58 100 \, 100;
#X text 215 156 0 \, 0;
#X text 92 276 -100 \, -100;
#X text 226 164 ------------------------------> w;
#X text 24 301 The black square has the same coordinates as the bounding
box for the black 'circle'. I created the green 'circle' using coordinates
0 \, 100 \; w \, 0 \; 0 \, -100 \; -100 \, 0 \; when I did not know
curves use a bounding box to control the curve (rather than points
on the curve);
#X connect 2 0 3 0;
#X connect 4 0 6 3;
#X connect 5 0 4 0;
#X connect 6 0 3 1;
#X connect 7 0 8 0;
#X connect 7 1 5 0;
#X connect 8 0 6 0;
#X connect 9 0 7 0;




More information about the Pd-list mailing list