pub struct Point {
pub position: Vector3,
pub orientation: Quaternion,
pub timestamp: Timestamp,
pub frame: String,
}Expand description
Represents a point in space with a position, orientation, and timestamp.
The Point struct encapsulates a 3D position using a Vector3, an orientation
using a Quaternion, and a Timestamp to indicate when the point was recorded.
§Examples
use transforms::{
geometry::{Point, Quaternion, Vector3},
time::Timestamp,
};
let position = Vector3 {
x: 1.0,
y: 2.0,
z: 3.0,
};
let orientation = Quaternion {
w: 1.0,
x: 0.0,
y: 0.0,
z: 0.0,
};
let timestamp = Timestamp::zero();
let frame = String::from("a");
let point = Point {
position,
orientation,
timestamp,
frame,
};
assert_eq!(point.position.x, 1.0);
assert_eq!(point.orientation.w, 1.0);Fields§
§position: Vector3§orientation: Quaternion§timestamp: Timestamp§frame: StringTrait Implementations§
Source§impl PartialOrd for Point
impl PartialOrd for Point
Source§impl Transformable for Point
The Transformable trait defines an interface for objects that can be transformed
using a Transform. Implementors of this trait can apply a transformation to
themselves, modifying their position and orientation.
impl Transformable for Point
The Transformable trait defines an interface for objects that can be transformed
using a Transform. Implementors of this trait can apply a transformation to
themselves, modifying their position and orientation.
Below is an example of how to implement the Transformable trait for a Point.
§Examples
use transforms::{
geometry::{Point, Quaternion, Vector3},
time::Timestamp,
Transform, Transformable,
};
let position = Vector3 {
x: 1.0,
y: 2.0,
z: 3.0,
};
let orientation = Quaternion {
w: 1.0,
x: 0.0,
y: 0.0,
z: 0.0,
};
let timestamp = Timestamp { t: 0 };
let frame = String::from("b");
let mut point = Point {
position,
orientation,
timestamp,
frame,
};
let transform = Transform {
translation: Vector3 {
x: 2.0,
y: 0.0,
z: 0.0,
},
rotation: Quaternion {
w: 1.0,
x: 0.0,
y: 0.0,
z: 0.0,
},
timestamp: Timestamp { t: 0 },
parent: "a".into(),
child: "b".into(),
};
let r = point.transform(&transform);
assert!(r.is_ok());
assert_eq!(point.frame, "a");
assert_eq!(point.position.x, 3.0);impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more