Phase1 working branch#6
Merged
Merged
Conversation
Implement Phase 1 geometry crate (arcanum-geometry)
Completes the full Phase 1 pipeline: MeshInput → Mesh.
**Data structures** (mesh.rs, errors.rs)
- Segment, CurveParams (Linear/Arc/Helix), Junction, GroundDescriptor,
TagMap, Mesh output types
- GeometryError / GeometryWarnings distinct from nec-import error types
**Wire discretization** (discretize.rs)
- Closed-form parametric evaluation for straight, arc, and helix wires
- Endpoints computed at t = k/N — no incremental accumulation
**Geometry transforms** (transforms.rs)
- GS global scale (coordinates only; wire_radius not scaled)
- GM rotation (ROX→ROY→ROZ), translation, and n_copies generation
with incremented tags
**Junction detection** (junctions.rs)
- Union-find over all segment endpoint pairs
- Intra-wire adjacent boundaries excluded (not junctions)
- Near-coincident warning: gap in [ε, 10ε] where ε = min(r_a,r_b)×0.01
- Self-loop detection for full-circle arcs
**PEC image generation** (images.rs)
- Reflects z → -z for all segments not in the z=0 plane
- WireInGroundPlane warning for segments entirely at z=0
- Bug fix: image segments inherit wire_index from their source segment
(was incorrectly set to the loop counter, producing false junctions
between adjacent image segments)
**Tag map** (tagmap.rs)
- Maps NEC wire tags to segment index ranges; image segments excluded
**Public API** (lib.rs)
- build_mesh(input: MeshInput, ground_electrical: Option<GroundElectrical>)
-> Result<(Mesh, GeometryWarnings), GeometryError>
**Tests** (23 cases across 7 files)
- V-LIN-001 through V-LIN-006, V-ARC-001 through V-ARC-003
- V-HEL-001 through V-HEL-003, V-TRF-001 through V-TRF-004
- V-GND-001 through V-GND-004, V-TAG-001, V-WARN-001 through V-WARN-002
- Junction count assertions added to V-GND-002, V-GND-004, V-HEL-003
to prevent regression of the wire_index bug
Exposed geometry types and build_mesh() via PyO3:
- GeometryError exception, GeometryWarning, Segment, Junction,
GroundDescriptor, Mesh
- build_mesh(mesh_input, ground_electrical=None) -> (Mesh, [GeometryWarning])
- design.md (→ Rev 0.2): added Section 5.2 "What a Junction Is Not";
valence-counting clarification; renumbered subsections
- validation.md (→ Rev 0.4): corrected V-LIN-001/003/004 junction
semantics; fixed GH card strings in V-HEL-001/002/003; added junction
expectations to V-GND-002/004 and V-HEL-003; removed convergence
plots requirement (closed-form evaluation makes it unnecessary)
examples/mesh_inspect.py: end-to-end example that parses a NEC deck,
calls build_mesh, and prints a human-readable mesh summary (segment
table, tag map, junctions, ground descriptor, warnings).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1 complete