in Rust/src/pointstore.rs [97:131]
fn get_shingled_point(&self, point: &[f32]) -> Vec<f32> {
let mut new_point = vec![0.0; self.dimensions];
if self.internal_shingling {
let base = self.dimensions / self.shingle_size;
if point.len() != base {
println!("The point must be '{}' floats long", self.dimensions);
panic!();
}
if !self.internal_rotation {
for i in 0..(self.dimensions - base) {
new_point[i] = self.last_known_shingle[i + base];
}
for i in 0..base {
new_point[self.dimensions - base + i] = point[i];
}
} else {
for i in 0..(self.dimensions) {
new_point[i] = self.last_known_shingle[i];
}
let offset = (self.next_sequence_index * base) % self.dimensions;
for i in 0..base {
new_point[offset + i] = point[i];
}
}
return new_point;
}
if point.len() != self.dimensions {
println!("The point must be '{}' floats long", self.dimensions);
panic!();
}
for i in 0..self.dimensions {
new_point[i] = point[i];
}
new_point
}