Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/flightlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,13 @@ export function FlightLog(logData) {
z: srcFrame[imuQuaternion[2]] / scaleFromFixedInt16,
w: 1.0,
};
q.w = Math.sqrt(1.0 - (q.x ** 2 + q.y ** 2 + q.z ** 2));

const m = q.x ** 2 + q.y ** 2 + q.z ** 2;
if (m < 1.0) {
q.w = Math.sqrt(1.0 - m);
} else {
q.w = 0.0;
}
const xx = q.x ** 2,
xy = q.x * q.y,
xz = q.x * q.z,
Expand Down