feo_math/rotation/
rotor.rs1use crate::{Construct, One, Two, Zero, axes::Axes, linear_algebra::{matrix3::Matrix3, vector3::Vector3}};
6
7use super::{Rotation, euler::Euler, quaternion::Quaternion};
8
9pub struct Rotor<T>(pub T, pub T, pub T, pub T);
11
12impl<T> Rotor<T> {
13 pub fn new(x_rot: T, y_rot: T, z_rot: T, w_rot: T) -> Self {
14 Rotor(x_rot, y_rot, z_rot, w_rot)
15 }
16}
17
18impl<T> Rotation<T> for Rotor<T> where T: Construct<T> {
19 fn look_at_xy(_pos: Vector3<T>, _look_at: Vector3<T>) -> Self {
20 todo!()
21 }
22
23 fn look_at_xz(_pos: Vector3<T>, _look_at: Vector3<T>) -> Self {
24 todo!()
25 }
26
27 fn look_at_yz(_pos: Vector3<T>, _look_at: Vector3<T>) -> Self {
28 todo!()
29 }
30
31 fn look_at_lock(_pos: Vector3<T>, _look_at: Vector3<T>, _locked_axis: Vector3<T>) -> Self {
32 todo!()
33 }
34
35 fn camera_look_at_xy(pos: Vector3<T>, look_at: Vector3<T>) -> Self { Rotor::look_at_xy(look_at, pos) }
36
37 fn camera_look_at_xz(pos: Vector3<T>, look_at: Vector3<T>) -> Self { Rotor::look_at_xz(look_at, pos) }
38
39 fn camera_look_at_yz(pos: Vector3<T>, look_at: Vector3<T>) -> Self { Rotor::look_at_yz(look_at, pos) }
40
41 fn camera_look_at_lock(pos: Vector3<T>, look_at: Vector3<T>, locked_axis: Vector3<T>) -> Self {
42 Rotor::look_at_lock(look_at, pos, locked_axis)
43 }
44}
45
46impl<T> From<Rotor<T>> for Matrix3<T> {
47 fn from(_: Rotor<T>) -> Matrix3<T> {
48 todo!()
49 }
50}
51
52impl<T> From<Matrix3<T>> for Rotor<T> {
53 fn from(_: Matrix3<T>) -> Self {
54 todo!()
55 }
56}
57
58impl<T> From<Axes<T>> for Rotor<T>
59where T: Copy {
60 fn from(other: Axes<T>) -> Self {
61 Into::<Matrix3<T>>::into(other).into()
62 }
63}
64
65impl<T> From<Euler<T>> for Rotor<T>
66where T: Construct<T> + Copy {
67 fn from(e: Euler<T>) -> Self {
68 Into::<Matrix3<T>>::into(e).into()
69 }
70}
71
72impl<T> From<Quaternion<T>> for Rotor<T>
73where T: Construct<T> + Copy {
74 fn from(q: Quaternion<T>) -> Self {
75 Into::<Matrix3<T>>::into(q).into()
76 }
77}
78impl<T> Zero for Rotor<T> where T: Zero { const ZERO: Self = Rotor(T::ZERO, T::ZERO, T::ZERO, T::ZERO); }
79impl<T> One for Rotor<T> where T: One + Zero { const ONE: Self = Rotor(T::ZERO, T::ZERO, T::ZERO, T::ONE); }
80impl<T> Two for Rotor<T> where T: Two + Zero { const TWO: Self = Rotor(T::ZERO, T::ZERO, T::ZERO, T::TWO); }