use crate::{centroid, DistDot, Normal3, Point3, Precision, ScoreCalc};
#[cfg(feature = "nabo")]
pub mod nabo;
pub mod rstar;
pub trait Neuron {
fn len(&self) -> usize;
fn is_empty(&self) -> bool {
self.len() == 0
}
fn points(&self) -> Vec<Point3>;
fn centroid(&self) -> Point3 {
centroid(&self.points())
}
fn tangents(&self) -> Vec<Normal3>;
fn alphas(&self) -> Vec<Precision>;
}
pub trait QueryNeuron: Neuron {
fn query_dist_dots(&self, target: &impl TargetNeuron, use_alpha: bool) -> Vec<DistDot>;
fn query(
&self,
target: &impl TargetNeuron,
use_alpha: bool,
score_calc: &ScoreCalc,
) -> Precision {
self.query_dist_dots(target, use_alpha)
.iter()
.map(|dd| score_calc.calc(dd))
.sum()
}
fn self_hit(&self, score_calc: &ScoreCalc, use_alpha: bool) -> Precision;
}
pub trait TargetNeuron: QueryNeuron {
fn nearest_match_dist_dot(
&self,
point: &Point3,
tangent: &Normal3,
alpha: Option<Precision>,
) -> DistDot;
}