Skip to content

Geometry Authoring

RAMAL-EBX treats geometry as PHITS input. The viewport exists to make the simulation meaning visible, not to create an independent 3D model.

What the geometry means

Surfaces, cells, materials, source positions, tallies, and analysis regions are PHITS concepts owned by geometry.odin, phits.odin, and the Design editing files. A visible shape may be a construction surface, an inside or outside cell-expression term, a material region boundary, a world boundary, or a reference for a source/tally.

The important questions are:

  • Which PHITS object is selected?
  • What PHITS ID and card will be written?
  • Which cells reference the surface or cell?
  • What material and density define the region?
  • Is the final region bounded, non-empty, and inside the world?
  • What exact input will the immutable Case retain?

Current inspection layers

  • Construction shows surfaces and their PHITS IDs, dimensions, parameters, and expression membership.
  • Cell shows final CSG regions, material/density context, and cell diagnostics.
  • PHITS shows generated materials, surfaces, cells, source, tally, world, and their exported IDs.
  • Result shows the scoring grid, loaded dose/uncertainty field, profiles, and Result context.

editor_geometry.odin owns cached cell mesh, diagnostic, bounds, and picking queries. editor_viewport_interaction.odin owns selection, camera input, and gizmos. editor_viewport_overlays.odin owns labels and diagnostic/scientific overlays. Final-cell inspection goes through the CSG path described in CSG_MESH.md.

Diagnostics

The Design validation path reports blocking or actionable conditions including duplicate/invalid PHITS IDs, missing materials or references, invalid density, non-finite/degenerate surfaces, cyclic or self-excluding expressions, unbounded/empty/outside-world cells, detected material overlaps, and invalid source/tally/run parameters.

Outside-world material regions and detected material overlaps are blocking for a ready scientific Case. Intermediate geometry may remain visible while it is being repaired, but it is not ready for Case creation or execution.

PHITS preview

The Design UI provides a read-only generated PHITS Input Preview. It is the current whole-input view, not a selection-filtered card viewer. The source of truth remains the saved input owned by design_phits.odin and parsed/generated through phits_document.odin.

Authoring boundary

Scene_State joins editable Geometry and PHITS_State for the Design. CSG preview meshes and renderer buffers are disposable inspection state. Analyze uses a separate Scene_State reconstructed from the verified Attempt input, so editing or viewing a Result cannot modify the Design.

Design viewport controls

Camera presets, section toggle, and overlay toggle are always visible. Model and Inspector buttons hide either side panel; drag their inner edges or use View > Panel widths to resize them. These adjustments are session-local. Designs open with scientific overlays off; the source diagnostics remain available through Overlays. View contains detailed section, visibility, quality, and lighting controls. PHITS card previews scroll horizontally, and catalog selections wrap long names.

Cell selection rejects clipped triangle hits and includes the section-plane intersection with the authored cell. Construction picking intersects supported primitives rather than their bounding boxes. Source picking is enabled only with its overlay and competes by distance with geometry. Raw surfaces retain bounds-based selection.

The scene uses 4x multisample antialiasing when the GPU supports both its color and depth targets; otherwise it uses single-sample rendering. UI rendering remains separate from the scene resolve. Adding a construction surface frames it immediately. Incomplete Designs can be saved before a world is configured; this draft serialization does not bypass Case readiness checks.

Construction surfaces use neutral grey, transparent, two-sided shading in Filled preview. Sphere and cylinder/cone walls have smooth analytic normals; caps, boxes, and planes remain flat. Selection uses a blue outline and stronger neutral fill, with subdued hidden dashes. Material colours remain exclusive to cells; Inside/Outside meaning comes from the term labels and side arrows, not shading. Selecting a Cell or Surface switches the viewport to that geometry automatically; an always-visible label identifies Cell view or Surface view. Source selection and empty-space clicks preserve the last geometry context. Display remains an independent Filled or Wireframe choice. Cell wireframe follows evaluated CSG boundaries, including exclusions and transforms; shared coplanar triangle diagonals are removed. Edge buffers are cached and released with their generated mesh. Selecting a cell does not automatically select an expression term. Explicit surface-term inspection stays in Cell view and overlays only that boundary; selecting another cell ends term inspection. Fill opacity is shown only for Filled Surfaces. RPP, SPH, RCC, TRC, and clipped plane previews use finite display tessellations. Raw PHITS surfaces keep their card and bounds-based picking behavior without being invented as physical solids. Surface fills follow the section plane and scene depth, while the selected surface gets a stronger fill and crisp outline; only its occluded outline is drawn dashed. The bounded preview budget skips complete shapes and reports the reduced preview in the viewport rather than drawing partial tessellations. Cell-expression labels say Inside (-), Outside (+), or term-local cell exclusion so unions and complements are not presented as final inclusion. Construction overlays remain in authored geometry coordinates; transformed cell volumes continue through the final CSG preview path.

GUI regression check — 2026-09-08

In the separate GUI Verification September 7 project, the authoring check created a sphere, exercised undo/redo, and saved the incomplete Design. The automated lifecycle test also saves and reloads this intermediate state. A second Design imported the existing D7 diagnostic input through the file picker, created a Case, and started a local 1,000-history, one-batch run through Simulate. Attempt a0001 finished with return code zero, published its field and uncertainty artifacts, and automatically opened Analyze. This is workflow verification, not scientific convergence evidence. Remote execution and every primitive/edit combination were not exercised in this check.

Source shape inspection

The source inspector offers Focus Source, Source + Geometry, and View along source axis. Framing uses the transformed source support and viewport aspect ratio; the combined view includes visible material cells. These controls only change camera/overlay state. Source-axis views use the unique emission direction when available, otherwise the transformed source plane normal. The existing camera pitch limit remains 80 degrees, so views near the vertical axis are slightly oblique.

Gaussian sources now have an alpha-blended filled configured profile, an inner FWHM ring, and an outer preview-cutoff ring at radius twice FWHM. The outer ring is not a physical boundary. The fill shows the configured distribution before cell restriction; Restriction diagnostics adds sampled accepted/rejected crosses. A lack of accepted preview samples is not proof of no intersection. Rotated box outlines use their transformed corners, and planar circular sources use their transformed emission plane. Direction-arrow length is illustrative.

Source inspection ghosts geometry and draws occluded source outlines dashed, while the ordinary view remains opaque and depth-tested. This is a display aid, not physical transparency; it does not change cell visibility or PHITS records. Source fill and outlines follow the section cut. The inspection toggle resets when opening a Design. General transparent-material rendering and transformed source editing gizmos are outside this change.

Validation: automated checks cover transformed box endpoints, disk/Gaussian plane membership, nondegenerate fill triangles, unchanged source values after camera framing, and standalone PHITS input import. Shader compilation and the macOS debug build are checked separately. Live GUI verification completed on 2026-09-08 in the separate verification project: Gaussian gradient and FWHM, optional restriction diagnostics, both focus controls, source-axis view, ghosted geometry, dashed occluded source lines, and section clipping. Rotated box and disk fixtures imported through the GUI; the box retained its rotated edges and the disk appeared circular when viewed along its transformed source axis. The short-arrow check exposed and fixed an oversized arrowhead; heads now scale with arrow length.

The geometry-only fixtures omit a copied tally whose bare multiplier row requires additional import handling; that unrelated tally-import limitation is not resolved by these source rendering changes.