setFromAxisAngle method

Quaternion setFromAxisAngle(
  1. Vec3 vector,
  2. double angle
)

Set the quaternion components given an axis and an angle in radians.

Implementation

Quaternion setFromAxisAngle(Vec3 vector, double angle){
  final s = math.sin(angle * 0.5);
  x = vector.x * s;
  y = vector.y * s;
  z = vector.z * s;
  w = math.cos(angle * 0.5);
  return this;
}