Trio recalculation from cylinder points
Trio recalculation from cylinder points
Module trioEditRecalculation.ts. Recalculates trio geological properties when users edit points in the cylinder 3D editor.
The function takes 3 points in cylinder local coordinates and returns:
- plane geometry (alpha, beta, AC in viewer convention)
- dip / dipDirection
- depth (optional/null) consistent with scene (using
compositeImageDepthM)
1. Problem it solves
Previously, when editing trio points, it was easy for:
- alpha/beta and dip/dipDirection to drift out of sync
- depth calculation to depend on inconsistent heuristics across views
This module defines a single recalculation flow so edited trio data persists and appears consistently in:
- visualizacion 3D
- discos/elipses
- tablas/estats (dip/dipDirection/structureDepth)
2. recalculateTrioFromCylinderPoints(updatedPoints, opts)
2.1. Inputs
updatedPoints: TrioCylinderPoint[]- Must contain exactly 3 points
- Cylinder-local coordinates (meters)
opts:cylinderDiameter: string(H or N; cast to'H' | 'N'when dimensions are resolved)bohLines: { line1_angle?: number; line2_angle?: number }compositeImageDepthM: numbersondajeAzimuth?: numbersondajeInclination?: number
2.2. Internal flow (summary)
- Computes plane equation with
calculatePlaneFromThreePoints(p1,p2,p3). - Obtiene
dims = getCylinderDimensions(cylinderDiameter):- radio
dims.radius - altura
dims.height
- radio
- Computes ellipse points (64 segments) to derive beta:
calculateEllipsePoints(equation, dims.radius, 64)
- Computes BOH angle used for beta:
getBOHAngleForTrioPoints(bohLines, updatedPoints)- uses
90defaults when both BOH angles are not provided
- Calcula:
alpha = calculateAlpha(equation)beta = calculateBeta(equation, bohAngleForBeta, ellipsePoints)ac = calculateAC(l1, l2)(using l1/l2 fromopts.bohLines)
- Computes dip / dipDirection:
- if
sondajeAzimuthandsondajeInclinationexist, usesrecalculateDipFromAngles(...) - otherwise uses
calculateDip(equation)andcalculateDipDirection(equation)
- if
- Computes trio depth (
depthM):- requiere
compositeImageDepthMfinito - usa
calculateTrioDepthFromPoints(compositeImageDepthM, p1, p2, p3, dims.height)
- requiere
2.3. Output
Devuelve:
{ alpha, beta, ac, dip, dipDirection, depthM }
If:
updatedPoints.length !== 3-> returnsnull- any calculation fails -> returns
null
3. Validation checklist
- Edit one trio point:
- verify alpha/beta change consistently with plane
- verify dip/dipDirection do not jump unpredictably
- Edit in a case with defined BOH:
- confirm AC (
ac) is recalculated fromline1_angle/line2_angle
- confirm AC (
- Edit with and without
sondajeAzimuth/Inclination:- with metadata: use angle-based recalculation
- without metadata: use equation-based dip/dipDirection