[Cuis-dev] Pretty Cool Juan!

Hilaire Fernandes hilaire at drgeo.eu
Wed Jan 13 10:59:01 PST 2021

Work pretty well adding submorphs. Only requires little vector calculus 
to coop with the rotation center:

ProtractorMorph>>initialize | label p1 font |     super initialize .     
font _ FontFamily familyName: FontFamily defaultFamilyName pointSize: 4. 
     10 to: 170 by: 10 do: [:angle |         p1 _ Point r: 88 degrees: 
angle negated.         p1 _ p1 - (p1 normal * (font widthOfString: angle 
asString) / 2).         label _ LabelMorph contents: angle asString 
font: font.         label rotation: (90 - angle) degreesToRadians.     
     self addMorph: label.         label morphPosition: p1]

All the the necessary knowledge do construct such morph is in The Cuis Book.

What is interesting is how the width of the lines can be float number, 
here 1.0 ; 0.5 ; 0.6

Le 13/01/2021 à 16:17, Juan Vuletich via Cuis-dev a écrit :
> One way to do it is to add a submorph for each label, rotating it as 
> needed.

GNU Dr. Geo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210113/d8b56f32/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: protractor.png
Type: image/png
Size: 118093 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210113/d8b56f32/attachment-0001.png>

More information about the Cuis-dev mailing list