fix: widen graph layout - stronger charge repulsion, weaker centering, larger spiral spread

- chargeStrength: -1500 -> -2500 for more node repulsion
- centeringStrength: 0.25 -> 0.08 so clusters don't collapse
- spiralScale: sqrt(n)*25 -> sqrt(n)*60 for wider initial spread
- MEMORY_ORBIT_BASE: 120 -> 200 with 120px randomness range
- linkDistance: 200 -> 300, docMemoryDistance: 150 -> 220
- Weaker link strengths to let charge dominate
- preSettleTicks: 120 -> 250 for better initial layout
This commit is contained in:
Vorflux AI 2026-03-28 08:10:28 +00:00
parent 2902a71bef
commit acd94c3642
2 changed files with 18 additions and 18 deletions

View file

@ -9,22 +9,22 @@ export const MEMORY_BORDER_KEYS = {
export const FORCE_CONFIG = {
linkStrength: {
docMemory: 0.25,
version: 0.8,
docDocBase: 0.15,
fallback: 0.15,
docMemory: 0.12,
version: 0.5,
docDocBase: 0.08,
fallback: 0.08,
},
linkDistance: 200,
docMemoryDistance: 150,
chargeStrength: -1500,
collisionRadius: { document: 60, memory: 30 },
collisionStrength: 0.6,
centeringStrength: 0.25,
alphaDecay: 0.04,
linkDistance: 300,
docMemoryDistance: 220,
chargeStrength: -2500,
collisionRadius: { document: 70, memory: 35 },
collisionStrength: 0.7,
centeringStrength: 0.08,
alphaDecay: 0.025,
alphaMin: 0.001,
velocityDecay: 0.6,
velocityDecay: 0.45,
alphaTarget: 0.3,
preSettleTicks: 120,
preSettleTicks: 250,
}
export const GRAPH_SETTINGS = {

View file

@ -11,7 +11,7 @@ import type {
const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000
const ONE_DAY_MS = 24 * 60 * 60 * 1000
const MEMORY_ORBIT_BASE = 120
const MEMORY_ORBIT_BASE = 200
export function getMemoryBorderColor(
mem: GraphApiMemory,
@ -86,9 +86,9 @@ export function useGraphData(
const cx = canvasWidth / 2
const cy = canvasHeight / 2
const docCount = documents.length
// Compact spiral -- just enough to avoid overlap. The simulation
// handles the final spread via charge repulsion.
const spiralScale = Math.sqrt(docCount) * 25
// Wide spiral so documents start well-separated. The simulation
// refines positions but the initial spread prevents clustering.
const spiralScale = Math.sqrt(docCount) * 60
// Golden angle (~137.5 deg) produces optimal packing in a spiral
const goldenAngle = Math.PI * (3 - Math.sqrt(5))
@ -149,7 +149,7 @@ export function useGraphData(
// with slight randomness from hash for organic feel
const memAngle =
(i / memCount) * 2 * Math.PI + hashToUnit(mem.id) * 0.5
const memRadius = MEMORY_ORBIT_BASE + hashToUnit(`${mem.id}-r`) * 60
const memRadius = MEMORY_ORBIT_BASE + hashToUnit(`${mem.id}-r`) * 120
memNode = {
id: mem.id,
type: "memory",