[][src]Trait kalman_rs::sensor_traits::Transform

pub trait Transform {
    fn to_global(&self, input_point: Point3<f32>) -> Point3<f32>;
fn to_local(&self, input_point: Point3<f32>) -> Point3<f32>;
fn contains_from_local(
        &self,
        input: &Point3<f32>
    ) -> Result<bool, &'static str>; fn contains_from_global(
        &mut self,
        input_point: Point3<f32>
    ) -> Result<bool, &'static str> { ... } }

Transformations between global and local reference frames. Additionally, It can be used to check if a given local or global point is within the bounds of the sensor.

Required methods

fn to_global(&self, input_point: Point3<f32>) -> Point3<f32>

Converts a point in the global reference frame to a point in the local reference frame of the sensor.

fn to_local(&self, input_point: Point3<f32>) -> Point3<f32>

Converts a point in the local refernce frame of the sensor to the global reference frame.

fn contains_from_local(&self, input: &Point3<f32>) -> Result<bool, &'static str>

Checks if a local point is contained within the bounds of a sensor.

Loading content...

Provided methods

fn contains_from_global(
    &mut self,
    input_point: Point3<f32>
) -> Result<bool, &'static str>

Checks if a global point is contained within the localized bounds of a sensor.

Loading content...

Implementors

impl Transform for Rectangle[src]

fn to_global(&self, input_point: Point3<f32>) -> Point3<f32>[src]

Converts a point in the global reference frame to a point in the local reference frame of the sensor.

Examples

use nalgebra as na;
use na::Point3;
use kalman_rs::sensor_traits::Transform;
 
let rectangular_points = [Point3::new(0.0, 0.0, 0.0), 
                          Point3::new(5.0,0.0,0.0), 
                          Point3::new(0.0,5.0,0.0), 
                          Point3::new(5.0,5.0,0.0)];
let tfm_matrix : na::Matrix4<f32>= na::Matrix4::new(1.0,5.0,7.0,2.0,  3.0,5.0,7.0,4.0,  8.0,4.0,1.0,9.0, 2.0,6.0,4.0,8.0);
let mut rectangle_sensor = kalman_rs::Rectangle::new(rectangular_points, tfm_matrix).unwrap();
 
let global_point = rectangle_sensor.to_global(na::Point3::new(1.0, 2.0, 0.0));

fn to_local(&self, input_point: Point3<f32>) -> Point3<f32>[src]

Converts a point in the local refernce frame of the sensor to the global reference frame.

Examples

use nalgebra as na;
use na::Point3;
use kalman_rs::sensor_traits::Transform;
 
let rectangular_points = [Point3::new(0.0, 0.0, 0.0), 
                          Point3::new(5.0,0.0,0.0), 
                          Point3::new(0.0,5.0,0.0), 
                          Point3::new(5.0,5.0,0.0)];
let tfm_matrix : na::Matrix4<f32>= na::Matrix4::new(1.0,5.0,7.0,2.0,  3.0,5.0,7.0,4.0,  8.0,4.0,1.0,9.0, 2.0,6.0,4.0,8.0);
let mut rectangle_sensor = kalman_rs::Rectangle::new(rectangular_points, tfm_matrix).unwrap();
 
let global_point = rectangle_sensor.to_local(na::Point3::new(6.0, 3.0, 5.0));

fn contains_from_local(&self, input: &Point3<f32>) -> Result<bool, &'static str>[src]

Checks if a local point is contained within the bounds of a sensor. NOTE: plane() must be called before checking for bounds of the sensor since the normal vector must be calculated first.

Examples

use nalgebra as na;
use na::Point3;
use kalman_rs::sensor_traits::Transform;
 
let rectangular_points = [Point3::new(0.0, 0.0, 0.0), 
                          Point3::new(5.0,0.0,0.0), 
                          Point3::new(5.0,5.0,0.0),
                          Point3::new(5.0, 0.0, 0.0)];
let tfm_matrix : na::Matrix4<f32>= na::Matrix4::new(1.0,5.0,7.0,2.0,  3.0,5.0,7.0,4.0,  8.0,4.0,1.0,9.0, 2.0,6.0,4.0,8.0);
let mut rectangle_sensor = kalman_rs::Rectangle::new(rectangular_points, tfm_matrix).unwrap();
 
let is_point_on_sensor = rectangle_sensor.contains_from_local(&na::Point3::new(1.0, 6.0, 0.0));

fn contains_from_global(
    &mut self,
    input_point: Point3<f32>
) -> Result<bool, &'static str>
[src]

impl Transform for Trapezoid[src]

fn to_global(&self, input_point: Point3<f32>) -> Point3<f32>[src]

Converts a point in the global reference frame to a point in the local reference frame of the sensor.

Examples

use nalgebra as na;
use na::Point3;
use kalman_rs::sensor_traits::Transform;
let trapezoid_points = [Point3::new(0.0, 0.0, 0.0), 
                        Point3::new(5.0,1.0,0.0), 
                        Point3::new(5.0, 9.0,0.0), 
                        Point3::new(0.0,10.0,0.0)];
let tfm_matrix : na::Matrix4<f32>= na::Matrix4::new(1.0,5.0,7.0,2.0,  3.0,5.0,7.0,4.0,  8.0,4.0,1.0,9.0, 2.0,6.0,4.0,8.0);
let mut trap_sensor = kalman_rs::Trapezoid::new(trapezoid_points, tfm_matrix).unwrap();
 
let global_point = trap_sensor.to_global(na::Point3::new(1.0, 2.0, 0.0));

fn to_local(&self, input_point: Point3<f32>) -> Point3<f32>[src]

Converts a point in the local refernce frame of the sensor to the global reference frame.

Examples

use nalgebra as na;
use na::Point3;
use kalman_rs::sensor_traits::Transform;
 
let trapezoid_points = [Point3::new(0.0, 0.0, 0.0), 
                        Point3::new(5.0,1.0,0.0), 
                        Point3::new(5.0, 9.0,0.0), 
                        Point3::new(0.0,10.0,0.0)];
let tfm_matrix : na::Matrix4<f32>= na::Matrix4::new(1.0,5.0,7.0,2.0,  3.0,5.0,7.0,4.0,  8.0,4.0,1.0,9.0, 2.0,6.0,4.0,8.0);
let mut trap_sensor = kalman_rs::Trapezoid::new(trapezoid_points, tfm_matrix).unwrap();
 
let local_point = trap_sensor.to_local(na::Point3::new(4.0, 5.0, 6.0));

fn contains_from_local(&self, input: &Point3<f32>) -> Result<bool, &'static str>[src]

Checks if a local point is contained within the bounds of a sensor. NOTE: plane() must be called before checking for bounds of the sensor since the normal vector must be calculated first.

Examples

use nalgebra as na;
use na::Point3;
use kalman_rs::sensor_traits::Transform;
 
let trapezoid_points = [Point3::new(0.0, 0.0, 0.0), 
                        Point3::new(5.0,1.0,0.0), 
                        Point3::new(5.0, 9.0,0.0), 
                        Point3::new(0.0,10.0,0.0)];
let tfm_matrix : na::Matrix4<f32>= na::Matrix4::new(1.0,5.0,7.0,2.0,  3.0,5.0,7.0,4.0,  8.0,4.0,1.0,9.0, 2.0,6.0,4.0,8.0);
let mut trap_sensor = kalman_rs::Trapezoid::new(trapezoid_points, tfm_matrix).unwrap();
 
let is_point_on_sensor = trap_sensor.contains_from_local(&na::Point3::new(1.0, 6.0, 0.0));

fn contains_from_global(
    &mut self,
    input_point: Point3<f32>
) -> Result<bool, &'static str>
[src]

Loading content...