MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / fromAxisAngleRad

Method fromAxisAngleRad

src/main/java/field/linalg/Quat.java:444–455  ·  view source on GitHub ↗

Set this quaternion to be a representation of the supplied axis and angle (in radians). @param axis the rotation axis @param angle the angle in radians @return this

(Vec3 axis, double angle)

Source from the content-addressed store, hash-verified

442 * @param angle the angle in radians
443 * @return this
444 */
445 public Quat fromAxisAngleRad(Vec3 axis, double angle) {
446 double hangle = angle / 2.0;
447 double sinAngle = Math.sin(hangle);
448 double vLength = axis.length();
449
450 x = axis.x / vLength * sinAngle;
451 y = axis.y / vLength * sinAngle;
452 z = axis.z / vLength * sinAngle;
453 w = Math.cos(hangle);
454
455 return this;
456 }
457
458 /**

Callers 8

orbitLeftMethod · 0.80
orbitUpMethod · 0.80
rollMethod · 0.80
lookLeftMethod · 0.80
lookUpMethod · 0.80
rotateMethod · 0.80
rotateAroundMethod · 0.80
dragMethod · 0.80

Calls 2

sinMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected