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

Method setAngleAxis

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

Set this quaternion to be a representation of the supplied axis and angle (in radians). @param angle the angle in radians @param axisX the x-coordinate of the rotation axis @param axisY the y-coordinate of the rotation axis @param axisZ the z-coordinate of the rotation axis @return this

(double angle, double axisX, double axisY, double axisZ)

Source from the content-addressed store, hash-verified

325 * @param axisZ the z-coordinate of the rotation axis
326 * @return this
327 */
328 public Quat setAngleAxis(double angle, double axisX, double axisY, double axisZ) {
329 double hangle = angle / 2.0;
330 double sinAngle = Math.sin(hangle);
331 double vLength = Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ);
332
333 x = axisX / vLength * sinAngle;
334 y = axisY / vLength * sinAngle;
335 z = axisZ / vLength * sinAngle;
336 w = Math.cos(hangle);
337
338 return this;
339 }
340
341 /**

Callers 5

setMethod · 0.95
planarRotateMethod · 0.80
planarRotateMethod · 0.80
polarCubicToMethod · 0.80
polarCubicTo3Method · 0.80

Calls 1

sinMethod · 0.45

Tested by

no test coverage detected