pub fn find_on_cylinder(&self, a: &[f64], b: &[f64], radius: f64) -> Result<HashSet<usize>, StrError> {
        // check
        if self.ndim != 3 {
            return Err("this works in 3D only");
        }
        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 cylinder
        let nearest_containers = self.containers_near_cylinder(a, b, radius)?;

        // find container points near the cylinder
        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_cylinder_distance(a, b, radius, &item.x)?;
                if f64::abs(distance) <= self.radius_tol {
                    ids.insert(item.id.clone());
                }
            }
        }
        Ok(ids)
    }
/// Finds points on the surface of a cylinder (3D only)
///
/// # Input
///
/// `a` -- 3D point on the cylinder axis
/// `b` -- 3D point on the cylinder axis
/// `radius` -- cylinder radius
///
/// # Output
///
/// Returns the ids of points.
///
/// # Note
///
/// This works in 3D only.
Finds points on the surface of a cylinder (3D only)
Finds points on the surface of a cylinder ( 3D only )
pub fn find_on_cylinder(&self, a: &[f64], b: &[f64], radius: f64) -> Result<HashSet<usize>, StrError> {
        // check
        if self.ndim != 3 {
            return Err("this works in 3D only");
        }
        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 cylinder
        let nearest_containers = self.containers_near_cylinder(a, b, radius)?;
        // find container points near the cylinder
        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_cylinder_distance(a, b, radius, &item.x)?;
                if f64::abs(distance) <= self.radius_tol {
                    ids.insert(item.id.clone());
                }
            }
        }
        Ok(ids)
    }
pub fn find_on_cylinder ( & self , a : & [ f64 ] , b : & [ f64 ] , radius : f64 ) -> Result < HashSet < usize > , StrError > { // check if self . ndim != 3 { return Err ( " " ) ; } if a . len ( ) != self . ndim { return Err ( " " ) ; } if b . len ( ) != self . ndim { return Err ( " " ) ; } // find containers near the cylinder let nearest_containers = self . containers_near_cylinder ( a , b , radius ) ? ; // find container points near the cylinder 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_cylinder_distance ( a , b , radius , & item . x ) ? ; if f64 :: abs ( distance ) <= self . radius_tol { ids . insert ( item . id . clone ( ) ) ; } } } Ok ( ids ) }
Finds points on the surface of a cylinder (3D only)
Finds points on the surface of a cylinder ( 3D only )
&self
a
&[f64]
b
&[f64]
radius
f64
&self
a
&[f64]
b
&[f64]
radius
f64
input
`a` -- 3D point on the cylinder axis
`b` -- 3D point on the cylinder axis
`radius` -- cylinder radius
` a ` -- 3D point on the cylinder axis ` b ` -- 3D point on the cylinder axis ` radius ` -- cylinder radius
output
Returns the ids of points.
Returns the ids of points .
note
This works in 3D only.
This works in 3D only .