public Vector3d rotate ( double x , double y , double z ) { final double length = length ( ) ; if ( Math . abs ( length ) < GenericMath . DBL_EPSILON ) { throw new ArithmeticException ( "Cannot rotate by the zero quaternion" ) ; } final double nx = this . x / length ; final double ny = this . y / length ; final double nz = this . z / length ; final double nw = this . w / length ; final double px = nw * x + ny * z - nz * y ; final double py = nw * y + nz * x - nx * z ; final double pz = nw * z + nx * y - ny * x ; final double pw = - nx * x - ny * y - nz * z ; return new Vector3d ( pw * - nx + px * nw - py * nz + pz * ny , pw * - ny + py * nw - pz * nx + px * nz , pw * - nz + pz * nw - px * ny + py * nx ) ; }
Rotates the double components of a vector by this quaternion .