quaternionFromAngleAxis function

Array quaternionFromAngleAxis(
  1. double angle,
  2. Vector3 axis
)

Implementation

Array quaternionFromAngleAxis(double angle, Vector3 axis) {
  var v = axis.normalize() * sin(angle / 2);

  return Array(values: [
    for (var component in v.toList()) [component],
    [cos(angle / 2)],
  ]);
}