rotateY function
Rotate a 3D vector around the y-axis @param {vec3} out The receiving vec3 @param {ReadonlyVec3} a The vec3 point to rotate @param {ReadonlyVec3} b The origin of the rotation @param {Number} rad The angle of rotation in radians @returns {vec3} out
Implementation
List<double> rotateY(List<double> out, List<double> a, List<double> b, double rad) {
final p = [], r = [];
//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
p[2] = a[2] - b[2];
//perform rotation
r[0] = p[2] * math.sin(rad) + p[0] * math.cos(rad);
r[1] = p[1];
r[2] = p[2] * math.cos(rad) - p[0] * math.sin(rad);
//translate to correct position
out[0] = r[0] + b[0];
out[1] = r[1] + b[1];
out[2] = r[2] + b[2];
return out;
}