@@ -97,12 +97,19 @@ def depth_at(self, x: float, y: float, z: float) -> float:
9797 return self .trace_points .loc [closest_idx , DhConfig .depth ]
9898
9999 def find_implicit_function_intersection (
100- self , function : Callable [[ArrayLike ], ArrayLike ]
100+ self , function : Callable [[ArrayLike ], ArrayLike ], intersection_value : float = 0.0
101101 ) -> pd .DataFrame :
102102 """Find intersection of drillhole trace with an implicit function.
103103
104104 The provided function may be vectorised (accepting an Nx3 array and returning N values)
105105 or accept separate x,y,z arrays. Returns DataFrame with columns: depth, x, y, z.
106+
107+ Parameters
108+ ----------
109+ function : Callable[[ArrayLike], ArrayLike]
110+ Implicit function defining the surface to intersect with
111+ intersection_value : float, default 0.0
112+ The value at which to find intersections (default is 0.0)
106113 """
107114 pts = self .trace_points
108115 coords = np .vstack ([pts ["x" ].values , pts ["y" ].values , pts ["z" ].values ]).T
@@ -125,7 +132,7 @@ def find_implicit_function_intersection(
125132 intersections = []
126133
127134 # Handle exact zeros first
128- zero_idxs = np .where (np .isclose (values , 0.0 ))[0 ]
135+ zero_idxs = np .where (np .isclose (values , intersection_value ))[0 ]
129136 for idx in zero_idxs :
130137 d = float (depths [idx ])
131138 intersections .append (
@@ -381,7 +388,7 @@ def trace(self, step: float = 1.0) -> DrillHoleTrace:
381388 return DrillHoleTrace (self , interval = step )
382389
383390 def find_implicit_function_intersection (
384- self , function : Callable [[ArrayLike ], ArrayLike ], step : float = 1.0
391+ self , function : Callable [[ArrayLike ], ArrayLike ], step : float = 1.0 , intersection_value : float = 0.0
385392 ) -> pd .DataFrame :
386393 """Find intersection of drillhole trace with an implicit function.
387394
@@ -401,7 +408,7 @@ def find_implicit_function_intersection(
401408 DataFrame of intersection points with columns: depth, x, y, z
402409 """
403410 trace = self .trace (step )
404- df = trace .find_implicit_function_intersection (function )
411+ df = trace .find_implicit_function_intersection (function , intersection_value = intersection_value )
405412 df [DhConfig .holeid ] = self .hole_id
406413 return df
407414
0 commit comments