linear_ransac/
types.rs

1#[derive(Debug, Clone, Copy, PartialEq)]
2pub struct Point {
3    pub x: f64,
4    pub y: f64,
5}
6
7impl Point {
8    pub fn new(x: f64, y: f64) -> Self {
9        Self { x, y }
10    }
11}
12
13#[derive(Debug, Clone, Copy)]
14pub struct LinearModel {
15    pub slope: f64,
16    pub intercept: f64,
17}
18
19impl LinearModel {
20    pub fn predict(&self, x: f64) -> f64 {
21        self.slope * x + self.intercept
22    }
23}