[−][src]Struct kalman_rs::Trapezoid
A struct for sensors of trapezoidal geometry
Methods
impl Trapezoid
[src]
pub fn new(
points: [Point3<f32>; 4],
tfm_matrix: Matrix<f32>
) -> Result<Trapezoid, &'static str>
[src]
points: [Point3<f32>; 4],
tfm_matrix: Matrix<f32>
) -> Result<Trapezoid, &'static str>
This is the constructor for the rectangular geometry. It expects a 4x4 nalgebra::Matrix4<f32>
that is invertible
and a 4 element array of nalgebra::Point3<f32>
. If the matrix is not invertible it will return Err(&str)
.
The provided matrix should be an affine transformation for converting from R2->R3
Examples
use nalgebra as na; use na::Point3; 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();
Trait Implementations
impl Plane for Trapezoid
[src]
fn plane(&mut self) -> Vector<f32>
[src]
Calculate the current normal vector of the plane of the surface.
NOTE: plane()
must be called before contains_from_local
since contains_from_local
requires the normal vector to be defined
Examples
use nalgebra as na; use na::Point3; use kalman_rs::sensor_traits::Plane; 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 normal_vector = trap_sensor.plane();
fn on_plane(&self, input_point: &Point3<f32>) -> Result<bool, &'static str>
[src]
Check if a given point is located on the same plane as the sensor
NOTE: plane()
must be called becuase the normal vector is not currently known
Examples
use nalgebra as na; use na::Point3; use kalman_rs::sensor_traits::Plane; 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 on_sensor_plane = trap_sensor.on_plane(&Point3::new(1.0, 1.0, 0.0)); //true
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]
&mut self,
input_point: Point3<f32>
) -> Result<bool, &'static str>
Checks if a global point is contained within the localized bounds of a sensor.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,