Hello all,
I'm about to start a project and wanted to ask on this list your ideas on how to approach it. I would like to get a dynamic string/symbol(with spaces) to be rendered with text3d as if it is following a spline. Where the baseline of each letter is a tangent to the spline curve. I'd like to be able to move the control points of this spline curve and change the text (including the number of letters) dynamically.
My first thought is to build a pmpd chain that will act as the "spline" then use tLia objects to control the position and rotation of individual letters (as separate text3d objects) Some issues are how to make a pmpd chain more like a spline, I guess having no flextion in the links? Spacing the letters could also be a challange.
Any other ideas of how to approach this? How intensive is the math for calculating the position of the letters based on some real spline-curve equation? Any examples how I may go about this method?
Any opions would be welcomed.
As for text3d in general It would be very very nice to be able to have support for:
* Text boxes that wrap the contents, by character, or by word, or with "-". A special line-break character{,sequence} would be nice too. You just define the bounding box for the text in gem units (or rows+columns) and it goes from there. Basically giving text3d the ability to manage multiple lines of text.
* Jusification within this box (left right centre flush)
* text following a spline? ;)
Thanks all!
Ben
On Apr 6, 2004, at 12:56 PM, B. Bogart wrote:
Any other ideas of how to approach this? How intensive is the math for calculating the position of the letters based on some real spline-curve equation? Any examples how I may go about this method?
How about the spline_path object inside a [until] loop? You could have arrays for translation, rotation and the text (not entirely sure how to do the latter). Each master GEM tick would trigger the repeat which would run through the spline path and put the letter in the right spot. I just whipped up a basic patch based on the spline_path example in 02.advanced that you can find at the end of this mail. You need to use the .tab files in examples/data/ for it to work.
Any opions would be welcomed.
As for text3d in general It would be very very nice to be able to have support for:
- Text boxes that wrap the contents, by character, or by word, or with
"-". A special line-break character{,sequence} would be nice too. You just define the bounding box for the text in gem units (or rows+columns) and it goes from there. Basically giving text3d the ability to manage multiple lines of text.
- Jusification within this box (left right centre flush)
I think these can be done in abstractions for the most part, or at the very least an attempt should be made to do them that way. That's really the way Pd was designed you know. ;)
- text following a spline? ;)
This starts getting into the question of what Pd/GEM is really 'good' at doing. I don't think really precise splined text is something GEM is particularly suited to doing. For one thing the user interface for defining the spline would be what? The array object doesn't really give you enough response for information, functionality and performance to be all that useful (it needs to at least need to give coordinate info about which element you are acting on). So that leaves something like entering in lines of text into a file or trying to algorithmically fill an array at runtime. The latter is potentially interesting while the former just seems like a royal pain in the ass.
cgc
#N canvas 523 227 653 517 10; #X floatatom 492 288 0 0 0 0 - - -; #X msg 421 55 1; #X msg 461 55 0; #X floatatom 463 210 0 0 0 0 - - -; #X obj 32 289 gemwin; #X msg 32 112 create; #X obj 350 226 gemhead; #X msg 40 139 destroy; #X msg 91 170 1; #X msg 90 208 0; #X obj 350 289 color; #X text 32 89 create and destroy the graphics window; #X text 134 184 turn rendering on and off; #N canvas 21 297 600 400 arrays 0; #N canvas 0 22 450 300 graph1 0; #X array array2 18 float 0; #X array array3 24 float 0; #X coords 0 1 15 -1 400 300 1; #X restore 63 4 graph; #X restore 26 474 page arrays; #X obj 421 254 spline_path 3 array2; #X obj 350 351 translate 1 0 0 0; #X obj 464 320 spline_path 3 array3; #X obj 421 98 metro 2000; #X text 109 29 this demonstrates the spline_path object; #X obj 28 345 loadbang; #X msg 28 380 ; array2 resize 18 ; array2 read ../data/valcolor.tab ; array3 resize 24 ; array3 read ../data/valmotion.tab; #N canvas 26 40 290 300 Gem.init 0; #X obj 68 196 outlet; #X obj 68 86 loadbang; #X msg 68 136 reset; #X connect 1 0 2 0; #X connect 2 0 0 0; #X restore 82 261 pd Gem.init; #X obj 350 189 until; #X obj 354 122 gemhead; #X msg 354 163 31; #X obj 349 403 text3d hi; #X obj 480 395 openpanel; #X msg 475 428 font $1; #X obj 457 394 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 180 144 frame 10; #X obj 485 162 t b; #X obj 520 171 counter 0 10; #X obj 530 203 / 10; #X floatatom 429 125 5 0 0 0 - - -; #X msg 412 162 set $1; #X obj 527 113 moses 1; #X connect 0 0 16 0; #X connect 1 0 17 0; #X connect 2 0 17 0; #X connect 3 0 14 0; #X connect 5 0 4 0; #X connect 6 0 10 0; #X connect 6 0 30 0; #X connect 7 0 4 0; #X connect 8 0 4 0; #X connect 9 0 4 0; #X connect 10 0 15 0; #X connect 14 0 10 1; #X connect 15 0 25 0; #X connect 16 0 15 2; #X connect 19 0 20 0; #X connect 21 0 4 0; #X connect 22 0 6 0; #X connect 23 0 24 0; #X connect 24 0 22 0; #X connect 26 0 27 0; #X connect 27 0 25 0; #X connect 28 0 26 0; #X connect 29 0 4 0; #X connect 30 0 31 0; #X connect 31 0 32 0; #X connect 32 0 14 0; #X connect 32 0 16 0; #X connect 33 0 35 0; #X connect 34 0 24 0; #X connect 35 1 34 0; #X connect 35 1 31 3; #X connect 35 1 32 1;