the-pudding / sleep-training

MIT License
2 stars 2 forks source link

Bubble clustering #10

Closed tomvaillant closed 4 months ago

tomvaillant commented 4 months ago

Hey Matt, spent a couple hours trying different ways to cluster to force nodes. Started by trying understand the force clustering Observable code - but it's a bit too complex. Then tried using the force-cluster npm package, which I think would get us there but:

`const clusterCenters = positions.map((position, index) => {
                const angle = (index / positions.length) * Math.PI * 2;
                const radius = Math.min(innerWidth, height) / 3;
                const x = Math.cos(angle) * radius + innerWidth / 2;
                const y = Math.sin(angle) * radius + height / 2;
                return { x, y };
            });`
matthewfdaniels commented 4 months ago

have you posted your code?

also what's the link to the observable code?

tomvaillant commented 4 months ago

I have! It's the D3 instructions page you linked in the feedback sorry, here.

matthewfdaniels commented 4 months ago

I'm just not seeing this in your code. what component are you in?

image
tomvaillant commented 4 months ago

Gotcha! It looks like you're on an older version, can you git pull? I also just made some new pushes to main over the last hour (made some adjustments for feedback), you should see the clustering function commented out above the rerunSimulation function.

Bubbles.svelte is the right component.

matthewfdaniels commented 4 months ago

oh darn i was on my own branch from our pairing session. my bad!

On Fri, Jun 7, 2024 at 9:36 AM Tom @.***> wrote:

Gotcha! It looks like you're on an older version, can you git pull? I also just made some new pushes to main over the last hour (made some adjustments for feedback), you should see the clustering function commented out above the rerunSimulation function.

Bubbles.svelte is the right component.

— Reply to this email directly, view it on GitHub https://github.com/tomvaillant/sleep-training/issues/10#issuecomment-2154855826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV7FLVTBQDANM4WM5S4H7TZGGZN3AVCNFSM6AAAAABI2VHER2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJUHA2TKOBSGY . You are receiving this because you commented.Message ID: @.***>

matthewfdaniels commented 4 months ago

ok i got the observable example working in svelte. will replace it with your bubbles component in a branch!

matthewfdaniels commented 4 months ago

i just pushed a branch, refactoring your code a bit—hope it helps!

tomvaillant commented 4 months ago

WOW. That's a huge refactor. I'll dig into this and try to understand it, maybe on our next call you can walk me through a bit :) Thanks man.