Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
RotaryDialMorph
Last updated at 7:08 am UTC on 2 May 2017
I needed a clock-like morph for rotary dial stuff - barometer, speedo, compass, clock, thermometer etc.

Pretty clock & instrument faces probably requires using an ImageMorph as the background but it should be possible to just use color or trees of submorphs. Similarly the indicator needle could be an ImageMorph wrapped in a TransformationMorph but a drawn PolygonMorph would be ok (since they handle rotations internally).

Many dials are not full-circle displays and so we must maintain the start and stop angles of the arc desired. Since most people are more used to thinking in terms of 'degrees from vertical' rather than the strictly more appropriate 'radians from nominal East' we will use degrees. In order to make it possible to work out where the arc goes we will treat the start angle as the most-anti-clockwise point and run the arc clockwise to the stop angle. Thus a fairly typical barometer dial would run form about -130 degrees to +130, whereas an aircraft turn and slip indicator might go from +110 around the bottom of the circle to -110. Some dials have the needle pivot point other than at the centre, as with analog VU meters used on older audio equipment, or many analog electrical instruments. Whilst most dial instruments seem to hew to a standard of clockwise equals increasing value, this need not be the case and the morph needs to handle this; thus it is important that the starting value (which maps to the start angle) can be greater numerically than the stop value.

The current release is on SqueakSource at http://www.squeaksource.com/RotaryDialMorphs.html
Here are four specific dials as example -thermometer, humidistat, barometer and compass.
Screen Shot 2017-04-24 at 9.48 PM.png