normalize pt->quat
This commit is contained in:
parent
0f1c24ed37
commit
708b518047
1 changed files with 1 additions and 1 deletions
|
@ -27,7 +27,7 @@ fn yaw_to_angle(yaw: f32) -> f32 {
|
||||||
|
|
||||||
fn rotate_point(pt: &Vec3, rot: &Quat) -> Vec3 {
|
fn rotate_point(pt: &Vec3, rot: &Quat) -> Vec3 {
|
||||||
// thanks to https://danceswithcode.net/engineeringnotes/quaternions/quaternions.html
|
// thanks to https://danceswithcode.net/engineeringnotes/quaternions/quaternions.html
|
||||||
let [x, y, z] = pt.to_array();
|
let [x, y, z] = pt.normalize().to_array();
|
||||||
let qpt = Quat::from_xyzw(x, y, z, 0.0);
|
let qpt = Quat::from_xyzw(x, y, z, 0.0);
|
||||||
// p' = rot^-1 * qpt * rot
|
// p' = rot^-1 * qpt * rot
|
||||||
let rot_qpt = rot.inverse() * qpt * *rot;
|
let rot_qpt = rot.inverse() * qpt * *rot;
|
||||||
|
|
Loading…
Reference in a new issue