Skip to content

Claude/add mirrors lenses view v81u1 - #1

Merged
veillette merged 3 commits into
mainfrom
claude/add-mirrors-lenses-view-v81u1
Mar 1, 2026
Merged

veillette merged 3 commits into
mainfrom
claude/add-mirrors-lenses-view-v81u1

Conversation

@veillette

Copy link
Copy Markdown
Collaborator

No description provided.

claude added 3 commits March 1, 2026 16:10
Creates a dedicated Scenery node for every mirror and glass/lens model type:

Mirrors (src/rayTracing/view/mirrors/):
- SegmentMirrorView  – flat mirror with silver front + dark backing
- ArcMirrorView      – circular-arc mirror (circumcenter + arc sampling)
- ParabolicMirrorView– parabolic mirror (80-segment polyline, mirrors model logic)
- IdealCurvedMirrorView – golden line + tick marks (ideal element indicator)
- BeamSplitterView   – semi-transparent amber line

Glass / Lenses (src/rayTracing/view/glass/):
- CircleGlassView    – translucent blue filled circle
- PolygonGlassView   – translucent blue filled polygon (covers SphericalLens too)
- IdealLensView      – bold green line with arrowheads (converging/diverging)
- HalfPlaneGlassView – boundary line with hatching on the glass side

Factory & integration:
- OpticalElementViewFactory creates the correct view for any OpticalElement
- SimModel now builds a demo OpticsScene with all 10 element types
- SimScreenView replaced the placeholder with an elements layer wired to
  the model via the factory

https://claude.ai/code/session_01CRFkPktcpxMr9ufGuKpy7T
Minor metadata cleanup by npm (removed redundant "peer" flags).

https://claude.ai/code/session_01CRFkPktcpxMr9ufGuKpy7T
Each mirror and glass/lens view now supports:
- Body drag (grab the element to translate it)
- Endpoint handles (white circles) at key control points to reshape the element
- For arc/parabolic mirrors: a third handle at p3 to adjust curvature
- For CircleGlass: center handle translates the whole circle; boundary handle resizes radius
- For PolygonGlass: one handle per non-arc vertex for independent reshaping

All views share the createHandle / attachEndpointDrag / attachTranslationDrag
helpers from ViewHelpers.ts and implement a private rebuild() method that
updates path shapes and handle positions from the current model state.

https://claude.ai/code/session_01CRFkPktcpxMr9ufGuKpy7T
@veillette veillette self-assigned this Mar 1, 2026
@veillette
veillette merged commit 569b5de into main Mar 1, 2026
1 check passed
@veillette
veillette deleted the claude/add-mirrors-lenses-view-v81u1 branch March 2, 2026 19:50
veillette pushed a commit that referenced this pull request Apr 12, 2026
#1 – Centralize element labels in ElementRegistry
Add a `label: TReadOnlyProperty<string>` field to ElementDescriptor so the
registry is the single source of truth for element display names.  Export
`getElementLabel()`.  Remove the duplicate `buildTypeLabels()`/`TYPE_LABELS`
map from EditContainerNode and the now-unused StringManager import there.

#2 – Rename continuousSpectrumSource → ContinuousSpectrumSource
Fix the lone camelCase type key to match the PascalCase convention used by
all other element types.  Add a `case "continuousSpectrumSource":` fall-through
shim in elementSerialization.ts so scenes saved by older versions continue to
load without data loss.

#3 – Replace 4-arg buildEditControls signature with EditControlContext bag
Introduce `EditControlContext { signConvention, useCurvatureDisplay }` in
EditControlsResult.ts.  Update ElementDescriptor, the exported
buildEditControls() functions in ElementRegistry/EditControlFactory, and the
call site in EditContainerNode.  Registry entries that previously prefixed
unused params with `_` now destructure only what they need from the bag.
Adding a new display preference requires a single interface change, not
touching every builder signature.

#4 – Replace instanceof checks in OpticsScene.simulate() with interfaces
Add IAcquirable and ICompound to OpticsTypes.ts, with corresponding type
guards (isAcquirable, isCompound).  DetectorElement implements IAcquirable;
FiberOpticElement implements ICompound.  OpticsScene.simulate() uses the
guards instead of `instanceof DetectorElement` / `instanceof FiberOpticElement`,
removing its dependency on those concrete classes.

#5 – Make OpticsScene.getElement() O(1)
Add a `_elementById: Map<string, OpticalElement>` maintained by addElement /
removeElement / clearElements.  getElement() is now a single Map lookup
instead of a full array scan.

#6 – Fix SpatialIndex.getAllElements() O(n²) dedup
Replace the `all.includes(el)` linear scan inside a loop with a
`Set<OpticalElement>` accumulator, reducing the fast-path dedup from O(n²)
to O(n).

#7 – Extract syncBidirectional helper in SimScreenView
Replace three near-identical `let blockXSync = false` bidirectional-sync
patterns with a single generic `syncBidirectional(propA, propB)` helper.
The helper also writes propA's initial value to propB, removing the
separate initialization lines that preceded two of the three blocks.

https://claude.ai/code/session_01H65WqMzMK88Jkra4gAjhE7
veillette added a commit that referenced this pull request Apr 12, 2026
…view-vCe5N

Address architectural issues #1#7 from codebase review
veillette pushed a commit that referenced this pull request Jul 21, 2026
Finding #1: optical-element screen-reader names were generated from the
English class name via regex, bypassing i18n and never updating on locale
change. Add StringManager.getElementTypeNameProperty(type) mapping each
ELEMENT_TYPE_* to its localized component StringProperty; RayTracingCommonView
assigns that Property to accessibleName, falling back to the generated name
only for internal types (e.g. FiberCoreGlass).

Finding #2: the "∫I =" detector readout label was a hardcoded literal next to
a localized sibling. Add a detectorIntegratedIntensity key to en/fr/es, expose
it via getUIStrings(), and use it in DetectorChartPanel.

Mark both findings fixed in doc/scenerystack-review.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01US7abq5we9ZiLQ8j5YbUYK
veillette pushed a commit that referenced this pull request Jul 21, 2026
Finding #1: optical-element screen-reader names were generated from the
English class name via regex, bypassing i18n and never updating on locale
change. Add StringManager.getElementTypeNameProperty(type) mapping each
ELEMENT_TYPE_* to its localized component StringProperty; RayTracingCommonView
assigns that Property to accessibleName, falling back to the generated name
only for internal types (e.g. FiberCoreGlass).

Finding #2: the "∫I =" detector readout label was a hardcoded literal next to
a localized sibling. Add a detectorIntegratedIntensity key to en/fr/es, expose
it via getUIStrings(), and use it in DetectorChartPanel.

Mark both findings fixed in doc/scenerystack-review.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01US7abq5we9ZiLQ8j5YbUYK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants