Commit Graph

14 Commits

Author SHA1 Message Date
alro65 9a08526361 feat: AR-Shipdesign initial commit 2026-07-03 12:23:25 -04:00
alro65 36584f782c Lines plan visual overhaul: correct colors, full plan view symmetry
Color palette:
- Control net (nodes + connecting lines): neutral grey (#A8B8D0 / 110,120,140)
  — matches DELFTship convention for control polygon handles
- Forward stations (proa): bright green #22CC58
- Aft stations (popa): amber #C8A010
- Midship: orange #FF7020
- Node size reduced 4.5→3.0 px so hull curves dominate visually

Plan view (Vista de Planta):
- World bbox now symmetric: y ∈ [−B/2·1.22, +B/2·1.22] shows BOTH halves
- Waterlines drawn as closed contours: CL-AP → starboard curve → CL-FP
  → port curve (mirrored) → close at CL-AP
  Every waterline terminates at the centerline at bow and stern
- Control net grid: both directions (station-arm + waterline-arm) drawn
  on port AND starboard — same visual language as DELFTship control polygon
- Station reference lines span full beam (both sides)
- Centerline (eje de crujía) drawn as solid line dividing the two halves
- Edit nodes remain on starboard only; port updates symmetrically

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 21:05:20 -04:00
alro65 0cf7df2763 Fix lines-plan coordinate system: Y-inversion + add buttock lines
Root cause: base _w2s mapped world-Z directly to screen-Y (which
increases downward), placing the keel at the TOP of every viewer.

BodyPlanViewer:
- Override _w2s/_s2w/_fit_to_view to invert Y axis (keel now at bottom)
- Fix section drawing: remove keel-appended B-spline closure that
  distorted the curve; close section with a straight lineTo(0,0) instead

ProfileViewer:
- Same Y-inversion overrides as BodyPlanViewer
- Add _compute_buttock_pts() helper (interpolates Z at constant Y_b
  across all stations) and draw 3 buttock lines (B/4, B/2, 3B/4)
  as smooth curves in the profile view

Buttocks, stations and waterlines now appear in their correct views:
  Body Plan   → station cross-section curves, keel at bottom
  Profile     → buttock curves (vertical long. sections), keel at bottom
  Plan View   → waterline contours (unchanged)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 20:04:27 -04:00
alro65 58228080e8 fix(ui): smooth B-spline section/waterline curves + 3D ready-signal sync
- viewer_3d.py: add `ready` Signal emitted once QtInteractor finishes init
- main_window.py: connect ready signal to sync active hull into 3D viewer on startup
- viewer_lines.py: add _smooth_pts helper; replace straight polylines in BodyPlanViewer
  and PlanViewer CAPA 3 with B-spline interpolated curves (80 sample points)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 17:54:08 -04:00
alro65 eac3a3c965 fix(viewer): remove diagonal control-net fan lines from body plan
_draw_cnet_bodyplan: eliminated the longitudinal edges (same WL index
across all stations) — in the body plan all sections are overlaid in
the same y-z plane so those connections produce confusing diagonal
spoke patterns radiating from bow/stern.  Now only transverse section
polylines are drawn as the muted control-net underlay.

_draw_cnet_planview: likewise removed the redundant longitudinal layer
(waterline contours) because layer-3 already draws them bold on top.
Only the transverse station-direction edges are kept, which are the
genuinely new information in plan view.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 17:47:46 -04:00
alro65 a4b8b03a59 fix(ui): 3D stale cache + node/waterline visual hierarchy
hull.py
  - add invalidate() — clears _surface NURBS cache on in-place
    offsets edit; fixes 3D viewer showing old geometry after drag

main_window.py
  - call hull.invalidate() before load_hull() in
    _on_offsets_edited_from_viewer so PyVista always rebuilds mesh
    from the updated offsets

viewer_lines.py
  - 4-layer drawing order: grid → control-net → hull-curves → nodes
  - nodes changed from 4px white-blue circles to 6px orange squares
    (_NODE_NORMAL #FF8000) — unambiguous visual language vs blue/green
    hull curves
  - _draw_cnet_bodyplan / _draw_cnet_planview helpers: thin muted
    control-net mesh (transverse + longitudinal edges) drawn between
    grid and bold hull curves, matching Maxsurf/DelftShip visual style
  - waterline reference lines made more muted (_GRID_WL dotted)
  - all old _GRID / _CPT_* references replaced with new palette

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 14:06:18 -04:00
alro65 0f85935fc8 feat(stability): Módulo 3 — Curva GZ + criterios IMO IS Code 2008
- gz_integrator.py: GZCurve, GZPoint, compute_gz_wall_sided (fórmula
  pared lateral), compute_gz_direct (integración Sutherland-Hodgman)
- imo_is2008.py: IMOCriterion, IMOResult, check_imo_is2008 —
  6 criterios A.2.1.1–A.2.1.6 del IS Code 2008 Cap.2
- gz_curve_widget.py: GZCurveWidget QPainter — curva cian, áreas
  sombreadas, líneas IMO, marcador AVS, tabla PASS/FAIL integrada
- main_window.py: GZCurveWidget en MOD_STABILITY, _compute_and_show_gz,
  _on_show_stability conectado al ribbon
- dark.qss: estilos GZCurveWidget
- test_module3_stability.py: 33 tests S-01..S-28 (315 total, todos pasan)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 13:59:32 -04:00
alro65 62de89d63c Módulo 1: peine de curvatura + live cross-view durante drag (Tasks 17-18)
- viewer_lines.py: añade toggle curvatura (tecla C), señal offsets_dragging,
  método update_offsets (sin resetear zoom/pan), keyPressEvent, hint overlay,
  funciones _curvature_comb_data y _draw_curvature_comb para BodyPlan y Plan
- main_window.py: conecta offsets_dragging → slot ligero _on_offsets_dragging
  que actualiza vistas 2D en vivo; _on_offsets_edited_from_viewer usa
  update_offsets en lugar de set_hull para preservar zoom/pan al soltar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 13:26:35 -04:00
alro65 4630d2d19f Módulo 2 completo: HydrostaticsChartWidget + integración + tests (Tasks 14–16)
Task 14 — HydrostaticsChartWidget (QPainter):
- 9 paneles cuadrícula 3x3: Δ, V, Awp, LCB/LCF, KB/BMT, KMT/KML,
  TPC, MCT, Cb/Cw/Cm
- Cursor vertical compartido: clic/arrastre en cualquier panel mueve
  el cursor en todos y actualiza la barra de valores
- _InfoBar: franja superior con valores interpolados al calado activo
- _nice_ticks(): escala de ejes legible sin dependencias externas
- Sin dependencias externas (sólo PySide6 + numpy)

Task 15 — Integración en MainWindow:
- MOD_CURVES cargado con HydrostaticsChartWidget (sustituye placeholder)
- _on_compute_hydrostatics(): calcula HydrostaticCurves.compute(n=30)
- _on_show_hydrostatics(): abre el módulo (calculando si no hay datos)
- _on_export_hydrostatics_csv(): exporta CSV con QFileDialog
- Ribbon tab Análisis: botones Calcular, Curvas, Exp. CSV activos
- Menú Análisis → Hidrostática: 3 acciones funcionando
- dark.qss: estilos para hydrostaticsChart, hydroInfoBar, hydroPlaceholder

Task 16 — Tests V&V (58 tests):
- Widget headless W-01..W-08: construcción, set_curves, señales, clampeo
- CSV V037..V044: columnas, filas, monotonicidad, separadores, decimal coma
- at_draft V045..V049: interpolación lineal, clampeo, tipo retorno
- 5 familias V050..V055: Δ monótona, V>0, Cb∈(0,1), KMT>KB, KML>KMT, TPC>0
- IACS Rec.34 §4.3 V056..V062: Cb=4/9, Cw=2/3, KB, LCB=LCF=L/2, Cp=Cb/Cm,
  convergencia de malla <2%

Total: 282 tests, 0 failed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 09:21:27 -04:00
alro65 98ff57ed08 Módulo 1 fixes + Módulo 2 motor hidrostático (Tasks 13–13b)
Fixes Module 1 UI:
- wizard_cruiser/sailing/planing: perfiles sin^n calibrados por Cm, V-bottom
  con ángulo de astilla, corrección zona sobre chine planeador
- viewer_3d: buffer hull pendiente para eliminar race condition 500ms
- viewer_lines: reescritura completa — waterlines visibles, control points
  interactivos (drag DelftShip-style), señal offsets_edited
- main_window: conecta offsets_edited → slot _on_offsets_edited_from_viewer
  que propaga cambios a todos los visores, editor, 3D y barra hidrostática

Módulo 2 — motor HydrostaticCurves (Task 13):
- integrator.py: integrate() (Simpson+trapz), waterplane_strips(), section_areas()
- upright.py: UprightHydrostatics (19 campos), compute_upright() single-pass
- curves_of_form.py: HydrostaticCurves.compute(), at_draft(), to_csv_lines(), to_dict()
- tests/test_module2_hydrostatics.py: 83 tests — Wigley V&V, monotonicidad,
  CSV export, IACS Rec.34 §4.3–4.5; todos los 224 tests pasan

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 09:11:58 -04:00
alro65 2137b0a228 Modulo 1: editor interactivo de tabla de offsets (Task 10)
- offsets_editor.py: OffsetsEditor (QTableWidget editable con zoom de
  celdas modificadas en ambar, invalidas en rojo; Aplicar reconstruye Hull
  y emite hull_changed; importar/exportar CSV; info bar con dimensiones).

- main_window.py: OffsetsEditor inyectado como MOD_OFFSETS (F4);
  _load_hull_viewers recibe _skip_offsets_editor para evitar bucle;
  _on_hull_changed_from_editor propaga el Hull editado a todos los visores
  y al panel de hidrostáticos en vivo; ModuleArea.set_module_widget()
  para reemplazar placeholders en tiempo de setup.

86 tests pasan sin regresiones.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 08:30:30 -04:00
alro65 bdfd5ac4ca Módulo 1: visores 2D del plano de líneas + hidrostáticos en vivo
- viewer_lines.py: BodyPlanViewer, ProfileViewer, PlanViewer (QPainter,
  zoom/paneo, tema dark navy); conectados a los tres viewports 2D del
  layout 4-viewport (bodyplan / profile / plan).

- hull.py: añadidos waterplane_coefficient (Cw), it_waterplane (IT),
  il_waterplane (IL), bm_transverse (BMT), bm_longitudinal (BML),
  km_transverse (KMT), tpc, mct1cm — todos verificados analíticamente
  contra el casco Wigley (IACS Rec.34 §4.3).

- main_window.py: _load_hull_viewers() conecta los 4 visores y el panel
  hidrostáticos al crear un nuevo proyecto; _update_hydrostatics() puebla
  los 11 campos de la barra inferior en vivo.

- test_module1_hydrostatics.py: 35 tests nuevos (IT analítico exacto,
  consistencia BMT=IT/V, KMT=KB+BMT, TPC=Awp·ρ/1e5, visores headless).

Suite total: 86 tests — 86 passed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 08:25:09 -04:00
alro65 503e00bfc9 feat(sprint1): motor NURBS, modelos de casco, visor 3D PyVista
Geometría:
  - BSplineCurve: interpolación scipy, arc_length, tangente, chord-length
  - LoftedSurface: lofting de secciones → RectBivariateSpline bivariate

Core (casco Wigley como caso de prueba):
  - Section: área, centroide_z, max_half_breadth, curva B-spline
  - OffsetsTable: from_wigley(), to_sections(), interpolación xy
  - Hull: volumen, Awp, LCB, VCB, Cb, Cm, Cp, desplazamiento, to_mesh()

UI:
  - Viewer3DWidget (pyvistaqt.QtInteractor): casco Wigley por defecto
    al arrancar, fondo navy, waterplane semi-transparente, fallback
    graceful si PyVista no disponible
  - MainWindow: Viewer3DWidget inyectado en viewport Perspectiva 3D

Tests: 39 nuevos tests, fórmulas analíticas Wigley verificadas (±1%)
  V = 4BLT/9, Cb = 4/9, Awp = 2BL/3 (derivación correcta)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 01:07:35 -04:00
alro65 0dbc2a4518 v0.1-sprint0: Esqueleto completo AR-ShipDesign
- Estructura completa de carpetas (236 módulos stub + implementados)
- pyproject.toml, requirements, .gitignore, LICENSE (propietario)
- core/project.py: serialización .arsd (ZIP con JSON)
- core/units.py: conversiones SI <-> imperial completas
- ui/main_window.py: layout DELFTship-style con todos los paneles
  - Árbol de proyecto (dock izquierda)
  - Tabs de módulos (centro)
  - Panel de propiedades (dock derecha)
  - Panel hidrostáticos en vivo (inferior, fijo)
- ui/i18n: español e inglés
- ui/themes: tema claro y oscuro
- utils/logger.py, settings.py, validation.py
- data/liquids.json: 15 líquidos navales
- data/stability_criteria.json: IMO IS Code 2008, A.749(18), USCG
- tests/test_startup.py: 12 tests, todos PASSED
- Módulo scantling/ ISO 12215 (stubs Sprint 2.5)
- Módulo fabrication/molds/ para moldes FRP (stubs Sprint 13B)
- Módulo fabrication/ para CNC plasma/router/laser (stubs Sprint 13)
2026-05-26 22:10:18 -04:00