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

Method rotateAroundZ

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

Rotates the vector around the z 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 t

(double angle)

Source from the content-addressed store, hash-verified

485 * @return the same vector
486 */
487 @NotNull
488 public Vector rotateAroundZ(double angle) {
489 double angleCos = Math.cos(angle);
490 double angleSin = Math.sin(angle);
491
492 double x = angleCos * getX() - angleSin * getY();
493 double y = angleSin * getX() + angleCos * getY();
494 return setX(x).setY(y);
495 }
496
497 /**
498 * Rotates the vector around a given arbitrary axis in 3 dimensional space.

Callers 1

testRotationAroundZMethod · 0.80

Calls 4

getXMethod · 0.95
getYMethod · 0.95
setXMethod · 0.95
setYMethod · 0.45

Tested by 1

testRotationAroundZMethod · 0.64