Skip to main content

gondola_core/physics/
reconstruction.rs

1// This file is part of gaps-online-software and published 
2// under the GPLv3 license
3
4use crate::prelude::*;
5
6
7#[derive(Debug, Copy, Clone, PartialEq,FromRepr, AsRefStr, EnumIter)]
8#[repr(u8)]
9#[cfg_attr(feature = "pybindings", pyclass(eq, eq_int))]
10pub enum FitStatus {
11  Unknown        = 0u8,
12  DidNotConverge = 10u8,
13  Success        = 42u8,
14}
15
16expand_and_test_enum!(FitStatus, test_fitstatus_repr);
17
18
19/// Describe line depending on z since that is our
20/// best constrained value
21///
22/// This model has 6 free parameters, 3 for 
23/// the anchor point and 3 for the direction
24pub fn line3d(z : f32, x_a : f32, y_a : f32, z_a : f32, dx : f32, dy : f32, dz : f32) -> (f32, f32, f32) {
25  // avoid zero division error 
26  //let dx_nz : f32 = dx if dx !=0 {dx} else { 1e-5 };
27  //let dy_nz : f32 = dy if dy !=0 {dy} else { 1e-5 };
28  let dz_nz : f32 = if dz != 0.0 {dz} else { 1e-5 };
29  let x = x_a + ((dx/dz_nz) * (z - z_a));
30  let y = y_a + ((dy/dz_nz) * (z - z_a));
31  (x,y,z)
32}
33
34pub struct LineFit {
35}
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50