# 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: Any, 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 the 3D trajectory of a drillhole using survey data.

  Calculates X, Y, Z positions along the hole using minimum curvature or tangential approximation based on survey readings (depth, azimuth, dip).

  Parameters:

    - collar_point – Starting point (QgsPointXY or tuple).

    - collar_z – Starting elevation.

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

    - section_azimuth – Azimuth of the section line (for relative calcs).

    - densify_step – Distance between interpolated points in meters.

    - total_depth – Total depth of the hole.

  Returns:

    List of (depth, x, y, z, 0.0, 0.0) trajectory points.

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]], list[tuple[float, float, float]], list[tuple[float, float, float]]]]

  Interpolate interval attributes along drillhole trajectory.

  Ensures that even short intervals have at least two points by interpolating at the exact from/to depths on the trajectory segments.

  Parameters:

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

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

    - buffer_width – Maximum perpendicular offset to include a point.

  Returns:

    List of tuples (attribute, points_2d, points_3d, points_3d_proj).

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

  Project drillhole trajectory points onto the section line.

  Calculates the 2D projection (distance along section) and the offset (distance from section) for each point in a 3D trajectory.

  Parameters:

    - trajectory – List of 3D trajectory points (depth, x, y, z, …).

    - line_geom – Section line geometry.

    - line_start – Reference start point for distance calculation.

    - distance_area – Distance calculation utility.

  Returns:

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