Skip to content

Instantly share code, notes, and snippets.

@evgeniy2002
Created March 9, 2024 14:56
Show Gist options
  • Save evgeniy2002/e34e26012f5a3d0e4e192717a864c2f4 to your computer and use it in GitHub Desktop.
Save evgeniy2002/e34e26012f5a3d0e4e192717a864c2f4 to your computer and use it in GitHub Desktop.

Revisions

  1. evgeniy2002 created this gist Mar 9, 2024.
    10 changes: 10 additions & 0 deletions torus.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    for (let i = 0; i < count; i++) {
    const theta = Math.random() * 2 * Math.PI;
    const radius = lerp(min_radius, max_radius, Math.random());

    let x = radius * Math.sin(theta);
    let y = (Math.random() - 0.5) * 0.1;
    let z = radius * Math.cos(theta);

    positions.set([x, y, z], i * 3);
    }