punch out warnings and patch some readme
This commit is contained in:
12
ReadMe.md
12
ReadMe.md
@@ -1,13 +1,19 @@
|
||||
# Redoal
|
||||
> Defeating the DNS hedgemony through path comparisons of all possibilties of the curve on a DHT
|
||||
|
||||
A library to quantize input path data as a search tree enabling the core functionality of a DHT based path lookup.
|
||||
A library to quantize input path data as a search tree enabling the core functionality of a DHT to be used for path comparisons.
|
||||
|
||||
Local cache
|
||||
|
||||
# What it does
|
||||
|
||||
1. Optionally we preprocess input data, normalize, center weight and ensure it's not out of bounds, as a turning function.
|
||||
1. Optionally we asyncronously preprocess input data, normalize, center weight and ensure it's not out of bounds, as a turning function.
|
||||
|
||||
2.
|
||||
2. Cluster path data into a k-d tree.
|
||||
|
||||
3. Indexing - Store the tree coordinates in a hashmap with a unique key.
|
||||
|
||||
4. Query Processing - Query the tree for the nearest neighbor.
|
||||
|
||||
|
||||
|
||||
|
||||
15
src/lib.rs
15
src/lib.rs
@@ -2,14 +2,14 @@ use lyon::math::point;
|
||||
use lyon::path::Path;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TurningFunction {
|
||||
pub struct TurningFunction {
|
||||
steps: Vec<i32>,
|
||||
turns: Vec<f32>,
|
||||
trajectory: f32,
|
||||
}
|
||||
|
||||
impl TurningFunction {
|
||||
fn new(trajectory: f32) -> Self {
|
||||
pub fn new(trajectory: f32) -> Self {
|
||||
TurningFunction {
|
||||
steps: Vec::new(),
|
||||
turns: Vec::new(),
|
||||
@@ -18,14 +18,14 @@ impl TurningFunction {
|
||||
}
|
||||
|
||||
// update current trajectory and add increment
|
||||
fn add_increment(&mut self, step: i32, direction: f32) {
|
||||
pub fn add_increment(&mut self, step: i32, direction: f32) {
|
||||
let radian_diff = direction - self.trajectory;
|
||||
self.steps.push(step);
|
||||
self.turns.push(radian_diff);
|
||||
self.trajectory = self.trajectory + radian_diff;
|
||||
}
|
||||
|
||||
fn to_coordinates(&self) -> Vec<[f32; 2]> {
|
||||
pub fn to_coordinates(&self) -> Vec<[f32; 2]> {
|
||||
let mut coordinates = Vec::new();
|
||||
let mut x = 0.0;
|
||||
let mut y = 0.0;
|
||||
@@ -48,7 +48,7 @@ impl TurningFunction {
|
||||
}
|
||||
}
|
||||
|
||||
struct PathGenerator {
|
||||
pub struct PathGenerator {
|
||||
from: [f32; 2],
|
||||
turning_function: TurningFunction,
|
||||
to: [f32; 2],
|
||||
@@ -56,7 +56,7 @@ struct PathGenerator {
|
||||
|
||||
impl PathGenerator {
|
||||
// A function to calculate the path based on the turning function
|
||||
fn generate_path(&self) -> Path {
|
||||
pub fn generate_path(&self) -> Path {
|
||||
let mut builder = lyon::path::Path::builder();
|
||||
|
||||
// Start at the from point
|
||||
@@ -66,6 +66,9 @@ impl PathGenerator {
|
||||
for coord in self.turning_function.clone().to_coordinates() {
|
||||
builder.line_to(point(coord[0] + self.from[0], coord[1] + self.from[1]));
|
||||
}
|
||||
builder.line_to(point(self.to[0], self.to[1]));
|
||||
|
||||
builder.end(false);
|
||||
|
||||
// Build and return the path
|
||||
builder.build()
|
||||
|
||||
Reference in New Issue
Block a user