.sin FOR I%, 0, 127 N = INT(0.5 + 256 * SIN((I% / 128) * (PI / 2))) IF N >= 255 EQUB 255 ELSE EQUB N ENDIF NEXTName: sin [Show more] Type: Variable Category: Maths (Geometry) Summary: Table for sine valuesContext: See this variable in context in the source code References: This variable is used as follows: * GetSineAndCosine uses sin
This table contains sine values for a quarter of a circle, i.e. for the range 0 to 90 degrees, or 0 to PI/2 radians. The table contains values for indexes 0 to 127, which cover the quarter from 0 to PI/2 radians. Entry X in the table is therefore (X / 128) * (PI / 2) radians of the way round the quarter circle, so the table at index X contains the sine of this value. The value of sine across the quarter circle ranges from 0 to 1: sin(0) = 0 sin(90) = sin(PI/2) = 1 It might help to think of sin(X) as an integer ranging from 0 to 256 across the quarter circle, so entry X in this table contains sin(X) * 256, where X ranges from 0 to 128 over the course of a quarter circle.