Commit Graph

11 Commits

Author SHA1 Message Date
Avatarsia 72f6e67127 perf: time-based yield reduces background tab overhead by ~95%
Replace fixed-interval yields (every 4096 iterations) with time-based
yields (every ~100ms of wall time). In foreground tabs this means ~10
yields per second instead of ~50-200, with identical UI responsiveness.

In background tabs where setTimeout(0) is throttled to ~1s, this
reduces overhead from ~200 wasted seconds to ~10 — the export runs
nearly as fast in the background as in the foreground.

Addresses #2 (background tab resource allocation).
2026-04-06 05:23:09 +02:00
Avatarsia 689c192a89 fix: spatial index, decimation overflow, input validation, accessibility
Round 2 of performance and correctness improvements:

- Spatial grid index for brush painting: forEachTriInSphere now queries
  only nearby grid cells instead of scanning all triangles. ~5.7x faster
  for brush operations on 68k+ tri meshes.

- Decimation overflow fix: hasLinkViolation used a fixed 0x200000
  multiplier for vertex-pair keys, overflowing at >2M vertices.
  Now uses dynamic multiplier based on actual vertex count.

- Decimation determinant threshold: solveQ used absolute 1e-10 which
  fails for large coordinates. Now relative to matrix element magnitude.

- 3MF triangle index validation: bounds-check all parsed indices against
  vertex count, throw clear error on corrupt files instead of silent NaN.

- File size limit: reject files >500 MB before loading into memory,
  prevents browser tab crash on oversized files.

- Accessibility: preset swatches now keyboard-navigable (role=button,
  tabindex=0, Enter/Space to select). Modal dialogs trap focus and
  close on Escape.

- Ctrl+click straight line tool: click to set start point, Ctrl+click
  to paint a straight line between points. Ctrl+hover shows preview.

- Precision masking available for radius brush mode.

- Spatial grid rebuilt when entering/leaving precision mode.
2026-04-06 05:14:23 +02:00
Avatarsia 9b2fb68c47 perf: optimise QEM decimation heap and init phase
- SoAHeap: hole method for bubbleUp/sinkDown (half the typed-array
  writes per heap level vs the old swap approach).
- Seed dedup: Number keys instead of BigInt when vertex count < 94M
  (10-50x faster per key). BigInt fallback for extreme meshes.
- addCreaseQuadrics: encode face pairs as negative numbers instead
  of allocating small arrays per edge.
- Guard 3 (checkFlipped): single branch for corner index instead of
  9 ternary operations per face.
- Yield interval kept at 4096 with setTimeout(0) for reliable UI updates.
2026-04-06 02:38:46 +02:00
CNCKitchen 558a2301db Refactor code structure for improved readability and maintainability 2026-03-25 15:34:30 +01:00
CNCKitchen adab788c74 Refactor code structure for improved readability and maintainability 2026-03-18 10:52:39 +01:00
CNCKitchen f88504696d Refactor code structure for improved readability and maintainability 2026-03-18 09:31:21 +01:00
CNCKitchen 2c3db843a9 feat: optimize QEM mesh decimation with linked-list vertex-face incidence and performance enhancements 2026-03-17 22:28:39 +01:00
CNCKitchen 08eb15a2ab feat: enhance QEM mesh decimation with performance improvements and numeric key optimizations 2026-03-17 22:11:41 +01:00
CNCKitchen 2eb52a0bf2 feat: add brush cursor for exclusion tool and enhance cursor behavior 2026-03-17 20:57:27 +01:00
CNCKitchen 0e20de00dc Enhance subdivision algorithm to eliminate T-junctions with a two-step edge splitting approach 2026-03-17 11:08:00 +01:00
CNCKitchen 1a23d7d7fa added new triangle decimation 2026-03-17 10:16:50 +01:00