pub fn find_on_line(&self, a: &[f64], b: &[f64]) -> Result<HashSet<usize>, StrError> {
        // check
        if a.len() != self.ndim {
            return Err("a.len() must equal ndim");
        }
        if b.len() != self.ndim {
            return Err("b.len() must equal ndim");
        }

        // find containers near the line
        let nearest_containers = self.containers_near_line(a, b)?;

        // find container points near the line
        let mut ids = HashSet::new();
        for index in nearest_containers {
            let container = self.containers.get(&index).unwrap();
            for item in container.values() {
                let distance = point_line_distance(a, b, &item.x)?;
                if distance <= self.radius_tol {
                    ids.insert(item.id.clone());
                }
            }
        }
        Ok(ids)
    }
/// Finds points on a 2D or 3D line
///
/// # Input
///
/// * `a` -- (ndim) first point on the line
/// * `b` -- (ndim) second point on the line (different than `a`)
///
/// # Output
///
/// Returns the ids of points.
Finds points on a 2D or 3D line
Finds points on a 2D or 3D line
pub fn find_on_line(&self, a: &[f64], b: &[f64]) -> Result<HashSet<usize>, StrError> {
        // check
        if a.len() != self.ndim {
            return Err("a.len() must equal ndim");
        }
        if b.len() != self.ndim {
            return Err("b.len() must equal ndim");
        }
        // find containers near the line
        let nearest_containers = self.containers_near_line(a, b)?;
        // find container points near the line
        let mut ids = HashSet::new();
        for index in nearest_containers {
            let container = self.containers.get(&index).unwrap();
            for item in container.values() {
                let distance = point_line_distance(a, b, &item.x)?;
                if distance <= self.radius_tol {
                    ids.insert(item.id.clone());
                }
            }
        }
        Ok(ids)
    }
pub fn find_on_line ( & self , a : & [ f64 ] , b : & [ f64 ] ) -> Result < HashSet < usize > , StrError > { // check if a . len ( ) != self . ndim { return Err ( " " ) ; } if b . len ( ) != self . ndim { return Err ( " " ) ; } // find containers near the line let nearest_containers = self . containers_near_line ( a , b ) ? ; // find container points near the line let mut ids = HashSet :: new ( ) ; for index in nearest_containers { let container = self . containers . get ( & index ) . unwrap ( ) ; for item in container . values ( ) { let distance = point_line_distance ( a , b , & item . x ) ? ; if distance <= self . radius_tol { ids . insert ( item . id . clone ( ) ) ; } } } Ok ( ids ) }
Finds points on a 2D or 3D line
Finds points on a 2D or 3D line
&self
a
&[f64]
b
&[f64]
&self
a
&[f64]
b
&[f64]
input
`a` -- (ndim) first point on the line
`b` -- (ndim) second point on the line (different than `a`)
` a ` -- ( ndim ) first point on the line ` b ` -- ( ndim ) second point on the line ( different than ` a ` )
output
Returns the ids of points.
Returns the ids of points .