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)
| 425 | * @return the same vector |
| 426 | */ |
| 427 | @NotNull |
| 428 | public Vector rotateAroundX(double angle) { |
| 429 | double angleCos = Math.cos(angle); |
| 430 | double angleSin = Math.sin(angle); |
| 431 | |
| 432 | double y = angleCos * getY() - angleSin * getZ(); |
| 433 | double z = angleSin * getY() + angleCos * getZ(); |
| 434 | return setY(y).setZ(z); |
| 435 | } |
| 436 | |
| 437 | /** |
| 438 | * Rotates the vector around the y axis. |