normalize pt->quat

This commit is contained in:
Joe Ardent 2023-02-23 14:28:30 -08:00
parent 0f1c24ed37
commit 708b518047
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ fn yaw_to_angle(yaw: f32) -> f32 {
fn rotate_point(pt: &Vec3, rot: &Quat) -> Vec3 {
// 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);
// p' = rot^-1 * qpt * rot
let rot_qpt = rot.inverse() * qpt * *rot;