P5 Javascript Sketch - Penrose Tiling

Поділитися
Вставка
  • Опубліковано 16 лис 2024

КОМЕНТАРІ • 2

  • @adalbertofelipe
    @adalbertofelipe Місяць тому +1

    In your code, there is an unnecessary calculation, on (sketch.js) line 27: const bisector = opposite / tan(PI - HALF_PI - TYPES[type].angle);
    Because:
    PI - HALF_PI = HALF_PI, so you can declare: const bisector = opposite / tan(HALF_PI - TYPES[type].angle);
    Oh, and I didn't really understand this part:
    return p5.Vector
    .sub(b, d)
    .rotate(-HALF_PI)
    .setMag(bisector)
    .add(d);
    I didn't understand why you subtracted, rotated, entered the size and then added the vector.
    I even watched your video at part 32:10, but I didn't understand.

    • @rico_studio
      @rico_studio  Місяць тому

      Feel free to open a pull request on the repo for the fix