rotateY: Y-Axis Vector Rotation Transform
Matrix-based rotation around the Y-axis
The rotateY functions provide Y-axis rotation transformations for 3D and 4D vectors using matrix operations. These functions generate rotation matrices that rotate vectors around the Y-axis by a specified angle.
The mathematical foundation uses a 4D rotation matrix:
This matrix rotates points in the XZ-plane while preserving the Y-coordinate. The rotation follows the right-hand rule, where positive angles rotate counterclockwise when viewed from the positive Y-axis.
Available Functions
Function | Input Types | Description |
---|---|---|
rotateYVec3 | vec3, float | Rotate 3D vector around Y-axis |
rotateYVec3Center | vec3, float, vec3 | Rotate 3D vector around Y-axis with custom center |
rotateYVec4 | vec4, float | Rotate 4D vector around Y-axis |
rotateYVec4Center | vec4, float, vec4 | Rotate 4D vector around Y-axis with custom center |
ライブエディター
const fragment = () => { const angle = iTime const pos = vec3(uv.x, uv.y, 0).sub(0.5).mul(2.5) const rotated = rotateYVec3(pos, angle) const intensity = rotated.z.add(1).mul(0.5) const color = vec3(intensity, rotated.x.add(0.5), rotated.y.add(0.5)) return vec4(color, 1) }