# sec_interp.core.utils.drillhole module

Drillhole Utilities Module.

Calculations for drillhole geometry and projection.

sec_interp.core.utils.drillhole.calculate_drillhole_trajectory(collar_point: qgis.core.QgsPointXY, collar_z: float, survey_data: list[tuple[float, float, float]], section_azimuth: float, densify_step: float = 1.0, total_depth: float = 0.0) → list[tuple[float, float, float, float, float, float]]

  Calculate 3D trajectory of a drillhole using survey data.

  Uses the tangential method for trajectory calculation with densification to generate intermediate points for continuous interval projection.

  Parameters:

    - collar_point – QgsPointXY of collar location (X, Y).

    - collar_z – Elevation of collar (Z).

    - survey_data – List of tuples (depth, azimuth, inclination) sorted by depth.

    - section_azimuth – Azimuth of the section line in degrees.

    - densify_step – Distance in meters between interpolated points (default 1.0m).

    - total_depth – Optional total depth. If greater than last survey depth, trajectory will be extrapolated using last orientation.

  Returns:

    - depth: Depth along the hole.

    - x, y, z: 3D coordinates.

    - dist_along_section: Distance along the section line (initially 0.0).

    - offset_from_section: Perpendicular distance from section line (initially 0.0).

  Return type:

    A list of tuples (depth, x, y, z, dist_along_section, offset_from_section)

sec_interp.core.utils.drillhole.project_trajectory_to_section(trajectory: list[tuple], line_geom: qgis.core.QgsGeometry, line_start: qgis.core.QgsPointXY, distance_area: qgis.core.QgsDistanceArea) → list[tuple[float, float, float, float, float, float]]

  Project drillhole trajectory points onto section line.

  Parameters:

    - trajectory – List of (depth, x, y, z, _, _) from calculate_drillhole_trajectory.

    - line_geom – QgsGeometry of the section line.

    - line_start – QgsPointXY of the section line start.

    - distance_area – QgsDistanceArea for geodesic measurements.

  Returns:

    - depth: Original depth.

    - x, y, z: Original 3D coordinates.

    - dist_along: Projected distance along the section line.

    - offset: Perpendicular offset from the section line.

  Return type:

    List of tuples (depth, x, y, z, dist_along, offset)

sec_interp.core.utils.drillhole.interpolate_intervals_on_trajectory(trajectory: list[tuple], intervals: list[tuple[float, float, Any]], buffer_width: float) → list[tuple[Any, list[tuple[float, float]]]]

  Interpolate interval attributes along drillhole trajectory.

  Filters and maps geological intervals onto the 3D trajectory points that fall within the specified section buffer.

  Parameters:

    - trajectory – List of (depth, x, y, z, dist_along, offset) tuples.

    - intervals – List of (from_depth, to_depth, attribute) tuples.

    - buffer_width – Maximum perpendicular offset to include a point.

  Returns:

    - attribute: The metadata/geology associated with the interval.

    - points: List of (distance, elevation) coordinates for rendering.

  Return type:

    List of tuples containing