sec_interp.core.services.vertical_exaggeration_service module

Adaptive Vertical Exaggeration Service.

This module calculates the optimal vertical exaggeration (VE) for a cross-section from its geometric properties (elevation vs. distance range) and structural measurement density. It is QGIS-agnostic and thread-safe.

Algorithm reference: docs/plans/implementation_plan_adaptive_ve_v3.8.0.md.

class sec_interp.core.services.vertical_exaggeration_service.VerticalExaggerationService

Bases: object

Calculate adaptive vertical exaggeration for section profiles.

The service derives an optimal VE from the profile aspect ratio (elevation_range / distance_range) modulated by the structural measurement density, clamped to [MIN_VERT_EXAG, MAX_VERT_EXAG].

All inputs are primitive domain types; the service holds no state and is safe to use from background threads.

ASPECT_EXPRESSIVE = 0.5
ASPECT_FLAT = 0.02
ASPECT_MODERATE = 0.1
BASE_EXPRESSIVE = 1.0
BASE_FLAT = 10.0
BASE_LOW = 5.0
BASE_MODERATE = 2.0
DEFAULT_VERT_EXAG = 1.0
DENSITY_DENSE = 0.1
DENSITY_SPARSE = 0.01
MAX_VERT_EXAG = 20.0
MIN_VERT_EXAG = 0.5
MULT_DENSE = 0.7
MULT_NEUTRAL = 1.0
MULT_SPARSE = 1.3
calculate(topo: list[tuple[float, float]] | None, struct: list[StructureMeasurement] | None) → float

Calculate the adaptive VE from topography and structural data.

Parameters:
  • topo – Sampled topographic profile as (distance, elevation) tuples. Empty or None returns DEFAULT_VERT_EXAG.

  • struct – Projected structural measurements. None or empty applies a neutral density multiplier (1.0).

Returns:

Adaptive vertical exaggeration rounded to 1 decimal, within [MIN_VERT_EXAG, MAX_VERT_EXAG].

calculate_from_result(result: PreviewResult) → float

Calculate the adaptive VE from a consolidated preview result.

Only synchronous layers (topography and structures) are considered; asynchronous layers (geology, drillholes) are intentionally excluded to keep the VE stable across async re-renders (plan v3.8.0, §5.1).

Parameters:

result – Consolidated preview result.

Returns:

Adaptive vertical exaggeration (see calculate()).