Skip to content

Instantly share code, notes, and snippets.

@MrTelanie
Created October 6, 2019 11:01
Show Gist options
  • Select an option

  • Save MrTelanie/45b18d9927f89921cd20751e098cc9e8 to your computer and use it in GitHub Desktop.

Select an option

Save MrTelanie/45b18d9927f89921cd20751e098cc9e8 to your computer and use it in GitHub Desktop.
/* original */
export function fromOrientation({ alpha, beta, gamma }, orientation) {
let rot = iquaternion(UP, degree(alpha))
.mul(RIGHT, degree(beta))
.mul(FORWARD, degree(gamma))
.mul(LEFT90);
rot = iquaternion(rot.dir, degree(orientation))
.mul(rot);
return rot;
}
/* curry */
const multiply = makeCurry(
(one, two) => one.multiply(two),
IQuaternion
);
export function fromOrientation({ alpha, beta, gamma }, orientation) {
const rot = multiply(UP, degree(alpha))
(RIGHT, degree(beta))
(FORWARD, degree(gamma))
(LEFT90);
return multiply(rot.dir, degree(orientation))
(rot);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment