Skip to navigation

Revs on the BBC Micro

Dashboard: handPixels

Name: handPixels [Show more] Type: Variable Category: Dashboard Summary: The number of pixels in the longest axis for the rev counter hand at various points in a half-quadrant Deep dive: Trigonometry
Context: See this variable in context in the source code References: This variable is used as follows: * DrawRevCounter calls handPixels

This table contains values that are used to calculate the coordinates of the end of the hand in the rev counter. The contents of the table are very close to the following (the values from the following calculation are shown in the comments below - they are close, but not quite a perfect match, so I haven't got this exactly right): FOR I%, 0, 21 EQUB INT(0.5 + 28 * COS((PI/4) * I% / 21)) NEXT This gives the length of the adjacent side of a right-angled triangle, with a hypotenuse of length 28, and an angle ranging from 0 to PI/4 (i.e. one eighth of a circle), split up into 21 points per eighth of a circle. In other words, if we have a clock whose centre is at the origin, then this table contains the x-coordinate of the end of a clock hand of length 28 as it moves from 3 o'clock to half past 4.
.handPixels EQUB 28 \ INT(0.5 + 28.00) = 28 EQUB 28 \ INT(0.5 + 27.98) = 28 EQUB 28 \ INT(0.5 + 27.92) = 28 EQUB 28 \ INT(0.5 + 27.82) = 28 EQUB 28 \ INT(0.5 + 27.69) = 28 EQUB 27 \ INT(0.5 + 27.51) = 28 (doesn't match) EQUB 27 \ INT(0.5 + 27.30) = 27 EQUB 27 \ INT(0.5 + 27.05) = 27 EQUB 27 \ INT(0.5 + 26.76) = 27 EQUB 26 \ INT(0.5 + 26.43) = 26 EQUB 26 \ INT(0.5 + 26.06) = 26 EQUB 26 \ INT(0.5 + 25.66) = 26 EQUB 25 \ INT(0.5 + 25.23) = 25 EQUB 25 \ INT(0.5 + 24.76) = 25 EQUB 24 \ INT(0.5 + 24.25) = 24 EQUB 24 \ INT(0.5 + 23.71) = 24 EQUB 23 \ INT(0.5 + 23.13) = 23 EQUB 22 \ INT(0.5 + 22.53) = 23 (doesn't match) EQUB 21 \ INT(0.5 + 21.89) = 22 (doesn't match) EQUB 20 \ INT(0.5 + 21.22) = 21 (doesn't match) EQUB 20 \ INT(0.5 + 20.53) = 21 (doesn't match) EQUB 20 \ INT(0.5 + 19.80) = 20 EQUB &81, &81 \ These bytes appear to be unused EQUB &81, &81 EQUB &81, &81