Procedural Drawing - Question! thanks!

    Sep 26 2013 | 3:04 pm
    Hi, I suppose I'm having a little trouble understanding this part of the tutorial in Max and I could use all the help I could get understanding this.
    The section of the drawing patch labeled 2 uses scale to draw a shape based on sine wave calculations. A counter object produces output ranging from 0 to the maximum value (set using the two number boxes to the right of the metro object). This is scaled from 0.0 to 6.283185 (2*pi), then sent to a sin object, which calculates the sine of the input value. This produces a sine wave that varies from -1.0 to 1.0 in range. This value is sent to another scale object which maps this range to the integer range 0 to 319 – the size range of the lcd object. This is used to provide the X locations of the line. A similar set of functions are used to set the Y location. These numbers are then inserted into a list (using pack, prepended with the lineto message (using prepend) and then sent to the lcd.
    I wonder why are the counter integers scaled to pi (6.283185) and not to another number? Also the number boxes below the scale. Why are .5 chosen?
    Thanks in advance

    • Sep 26 2013 | 5:23 pm
      6.28... or 2π (in radians) is the length of the circumference of a unit circle. Plotting the rotation of a single point on the circumference of the circle results in the sine function. Check the animation about 1/4 way down the page here: or
      If the value used were lower or higher than 2π, the entire range of the sine function would not be achieved or be exceeded - in either case creating discontinuities in the resultant (smooth) path. Try it in the example by changing the 6.28... scaling factor.
      As for the scaling, afterwards - they appear to be a fudge factor to keep the result within range for the LCD object - not really sure why those values (+0.5) are used in particular (hopefully there is/was a good reason) but they don't appear to be really significant to the outcome.
    • Sep 26 2013 | 5:38 pm
      a sin function goes from 0 to 2pi on X, and -1 to 1 on Y