MCPcopy Index your code
hub / github.com/PaperMC/Paper / rotateAroundX

Method rotateAroundX

paper-api/src/main/java/org/bukkit/util/Vector.java:443–451  ·  view source on GitHub ↗

Rotates the vector around the x axis. This piece of math is based on the standard rotation matrix for vectors in three dimensional space. This matrix can be found here: Rotation Matrix . @param angle the angle to rotate

(double angle)

Source from the content-addressed store, hash-verified

441 * @return the same vector
442 */
443 @NotNull
444 public Vector rotateAroundX(double angle) {
445 double angleCos = Math.cos(angle);
446 double angleSin = Math.sin(angle);
447
448 double y = angleCos * getY() - angleSin * getZ();
449 double z = angleSin * getY() + angleCos * getZ();
450 return setY(y).setZ(z);
451 }
452
453 /**
454 * Rotates the vector around the y axis.

Callers 1

testRotationAroundXMethod · 0.80

Calls 4

getYMethod · 0.95
getZMethod · 0.95
setYMethod · 0.95
setZMethod · 0.45

Tested by 1

testRotationAroundXMethod · 0.64