1- use std:: fmt:: Debug ;
21use std:: iter:: repeat_with;
32
43use ndarray:: { Array2 , ArrayView1 } ;
@@ -17,13 +16,13 @@ use crate::utils::{
1716 points_cross_mesh, random_dir, sdf_inner, Precision , FLAGS ,
1817} ;
1918
20- fn vec_to_point < T : ' static + Debug + PartialEq + Copy > ( v : Vec < T > ) -> Point < T > {
21- Point :: new ( v[ 0 ] , v[ 1 ] , v[ 2 ] )
22- }
19+ // fn vec_to_point<T: 'static + Debug + PartialEq + Copy>(v: Vec<T>) -> Point<T> {
20+ // Point::new(v[0], v[1], v[2])
21+ // }
2322
24- fn point_to_vec < T : ' static + Debug + PartialEq + Copy > ( p : & Point < T > ) -> Vec < T > {
25- vec ! [ p. x, p. y, p. z]
26- }
23+ // fn point_to_vec<T: 'static + Debug + PartialEq + Copy>(p: &Point<T>) -> Vec<T> {
24+ // vec![p.x, p.y, p.z]
25+ // }
2726
2827#[ pyclass]
2928pub struct TriMeshWrapper {
@@ -96,20 +95,21 @@ impl TriMeshWrapper {
9695 collected. into_pyarray ( py)
9796 }
9897
98+ // #[pyo3(signature = (points, n_rays=None, consensus=None, parallel=None))]
9999 pub fn contains < ' py > (
100100 & self ,
101101 py : Python < ' py > ,
102102 points : PyReadonlyArray2 < Precision > ,
103- n_rays : Option < usize > ,
103+ n_rays : usize ,
104104 consensus : usize ,
105105 parallel : bool ,
106106 ) -> & ' py PyArray1 < bool > {
107107 let p_arr = points. as_array ( ) ;
108108 let zipped = Zip :: from ( p_arr. rows ( ) ) ;
109109
110- let collected = if let Some ( n ) = n_rays {
110+ let collected = if n_rays >= 1 {
111111 // use ray casting
112- let rays = & self . ray_directions [ ..n ] ;
112+ let rays = & self . ray_directions [ ..n_rays ] ;
113113 let clos = |r : ArrayView1 < f64 > | {
114114 mesh_contains_point ( & self . mesh , & Point :: new ( r[ 0 ] , r[ 1 ] , r[ 2 ] ) , rays, consensus)
115115 } ;
@@ -242,7 +242,7 @@ impl TriMeshWrapper {
242242 . as_array ( )
243243 . rows ( )
244244 . into_iter ( )
245- . zip ( tgt_points. as_array ( ) . rows ( ) . into_iter ( ) )
245+ . zip ( tgt_points. as_array ( ) . rows ( ) )
246246 . zip ( 0_u64 ..)
247247 . for_each ( |( ( src, tgt) , i) | {
248248 if let Some ( ( pt, is_bf) ) = points_cross_mesh (
@@ -265,25 +265,6 @@ impl TriMeshWrapper {
265265 )
266266 }
267267
268- #[ deprecated]
269- pub fn intersections_many_threaded (
270- & self ,
271- src_points : Vec < Vec < Precision > > ,
272- tgt_points : Vec < Vec < Precision > > ,
273- ) -> ( Vec < u64 > , Vec < Vec < Precision > > , Vec < bool > ) {
274- let ( idxs, ( intersections, is_backface) ) = src_points
275- . into_par_iter ( )
276- . zip ( tgt_points. into_par_iter ( ) )
277- . enumerate ( )
278- . filter_map ( |( i, ( src, tgt) ) | {
279- points_cross_mesh ( & self . mesh , & vec_to_point ( src) , & vec_to_point ( tgt) )
280- . map ( |o| ( i as u64 , ( point_to_vec ( & o. 0 ) , o. 1 ) ) )
281- } )
282- . unzip ( ) ;
283-
284- ( idxs, intersections, is_backface)
285- }
286-
287268 pub fn intersections_many_threaded2 < ' py > (
288269 & self ,
289270 py : Python < ' py > ,
0 commit comments