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

Method fromAxisAngleDeg

src/main/java/field/linalg/Quat.java:486–497  ·  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

484 * @param angle the angle in radians
485 * @return this
486 */
487 public Quat fromAxisAngleDeg(Vec3 axis, double angle) {
488 double hangle = Math.PI*(angle/180.0) / 2.0;
489 double sinAngle = Math.sin(hangle);
490 double vLength = axis.length();
491
492 x = axis.x / vLength * sinAngle;
493 y = axis.y / vLength * sinAngle;
494 z = axis.z / vLength * sinAngle;
495 w = Math.cos(hangle);
496
497 return this;
498 }
499
500 /**

Callers 3

rotateMethod · 0.80
bakeTextureMethod · 0.80
leftMethod · 0.80

Calls 2

sinMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected