Applies rotation about arbitrary axis to matrix

@param axis
@param theta
@return rotation applied to this matrix
178813
function(axis, theta) {
        var x, y, z, s, c, t, tx, ty;
        x = axis.x;
        y = axis.y;
        z = axis.z;
        s = Math.sin(theta);
        c = Math.cos(theta);
        t = 1 - c;
        tx = t * x;
        ty = t * y;
		_TEMP.set(
			tx * x + c, tx * y + s * z, tx * z - s * y, 0, tx * y - s * z,
			ty * y + c, ty * z + s * x, 0, tx * z + s * y, ty * z - s * x,
			t * z * z + c, 0, 0, 0, 0, 1
		);
        return this.multiplySelf(_TEMP);
    }
901502
def qrotate(vector, axis, angle):
    
    n_axis = axis / vnorm(axis)
    sin_angle = np.expand_dims(np.sin(angle / 2), 0)
    if np.ndim(n_axis) == 1:
        n_axis = np.expand_dims(n_axis, 1)
        p__ = np.dot(n_axis, sin_angle)[:, np.newaxis]
    else:
        p__ = n_axis * sin_angle

    q__ = Quaternion(np.cos(angle / 2), p__)
    shape = vector.shape
    return np.einsum("kj, ikj->ij",
                     vector.reshape((3, -1)),
                     q__.rotation_matrix()[:3, :3]).reshape(shape)
346562
def theta(v):
    
    v = np.atleast_2d(v)
    dir_z = v[:, 2]
    return theta_separg(dir_z)
592724
def rotate_around(self, axis, theta):
        

        # Adapted from equations published by Glenn Murray.
        # http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html
        x, y, z = self.x, self.y, self.z
        u, v, w = axis.x, axis.y, axis.z

        # Extracted common factors for simplicity and efficiency
        r2 = u**2 + v**2 + w**2
        r = math.sqrt(r2)
        ct = math.cos(theta)
        st = math.sin(theta) / r
        dt = (u * x + v * y + w * z) * (1 - ct) / r2
        return Vector3((u * dt + x * ct + (-w * y + v * z) * st),
                       (v * dt + y * ct + (w * x - u * z) * st),
                       (w * dt + z * ct + (-v * x + u * y) * st))
631230
public Quaterniond rotateAxis(double angle, Vector3dc axis, Quaterniond dest) {
        return rotateAxis(angle, axis.x(), axis.y(), axis.z(), dest);
    }
574476
public Matrix4 setToRotation (IVector3 from, IVector3 to) {
        float angle = from.angle(to);
        if (angle < MathUtil.EPSILON) {
            return setToIdentity();
        }
        if (angle <= FloatMath.PI - MathUtil.EPSILON) {
            return setToRotation(angle, from.cross(to).normalizeLocal());
        }
        // it's a 180 degree rotation; any axis orthogonal to the from vector will do
        Vector3 axis = new Vector3(0f, from.z(), -from.y());
        float length = axis.length();
        return setToRotation(FloatMath.PI, length < MathUtil.EPSILON ?
                             axis.set(-from.z(), 0f, from.x()).normalizeLocal() :
                             axis.multLocal(1f / length));
    }
60709
@SuppressWarnings("checkstyle:magicnumber")
	public void setRotation(double angle) {
		final double[] tmpScale = new double[3];
		final double[] tmpRot = new double[9];
		getScaleRotate2x2(tmpScale, tmpRot);
		final double cos = Math.cos(angle);
		final double sin = Math.sin(angle);
		// R * S
		this.m00 = tmpScale[0] * cos;
		this.m01 = tmpScale[1] * -sin;
		this.m10 = tmpScale[0] * sin;
		this.m11 = tmpScale[1] * cos;
		// S * R
		//		this.m00 = tmp_scale[0] * cos;
		//		this.m01 = tmp_scale[0] * -sin;
		//		this.m10 = tmp_scale[1] * sin;
		//		this.m11 = tmp_scale[1] * cos;
	}
539975
function applyRotationMatrix(touch, axis) {
  const rotationMatrix = axisProperties.rotationMatrix[axis];

  return {
    pageX: rotationMatrix.x[0] * touch.pageX + rotationMatrix.x[1] * touch.pageY,
    pageY: rotationMatrix.y[0] * touch.pageX + rotationMatrix.y[1] * touch.pageY,
  };
}
228513
public Matrix3 setToTransform (IVector translation, double rotation, double scale) {
        return setToRotation(rotation).set(m00 * scale, m10 * scale, translation.x(),
                                           m01 * scale, m11 * scale, translation.y(),
                                           0f, 0f, 1f);
    }
909339
function(theta) {
			var co = Math.cos(theta);
			var si = Math.sin(theta);
			var xx = co * this.x - si * this.y;
			this.y = si * this.x + co * this.y;
			this.x = xx;
			return this;
		}
301605
function(theta) {
        _TEMP.identity();
        _TEMP.matrix[1][1] = _TEMP.matrix[2][2] = Math.cos(theta);
        _TEMP.matrix[2][1] = Math.sin(theta);
        _TEMP.matrix[1][2] = -_TEMP.matrix[2][1];
        return this.multiplySelf(_TEMP);
    }
94695
def mtx_rot(ax, theta, reps=1):
    

    # Imports
    import numpy as np
    from scipy import linalg as spla
    from ..const import PRM

    # Ensure |ax| is large enough for confident directionality
    if spla.norm(ax) < PRM.ZERO_VEC_TOL:
        raise ValueError("Norm of 'ax' is too small.")
    ## end if

    # Ensure ax is a normalized np.float64 3-vector
    ax = make_nd_vec(ax, nd=3, t=np.float64, norm=True)

    # Ensure reps is a positive scalar integer
    if not np.isscalar(reps):
        raise ValueError("'reps' must be scalar.")
    ## end if
    if not np.issubdtype(type(reps), int):
        raise ValueError("'reps' must be an integer.")
    ## end if
    if not reps > 0:
        raise ValueError("'reps' must be a positive integer.")
    ## end if

    # Ensure theta is scalar
    if not np.isscalar(theta):
        raise ValueError("'theta' must be scalar.")
    ## end if

    # Assemble the modified Levi-Civita matrix
    mod_lc = np.array([ [0, -ax[2], ax[1]],
                    [ax[2], 0, -ax[0]],
                    [-ax[1], ax[0], 0] ], dtype=np.float64)

    # Compute the outer product of the axis vector
    ax_oprod = np.dot(ax.reshape((3,1)), ax.reshape((1,3)))

    # Construct the base matrix
    #  Will need to refer to external math to explain this.
    base_mtx = np.add(
                        np.add( (1.0 - np.cos(theta)) * ax_oprod,
                                            np.cos(theta) * np.eye(3)
                              ),
                        np.sin(theta) * mod_lc
                     )

    # Construct the block-diagonal replicated reflection matrix
    rot_mtx= spla.block_diag(*[base_mtx for i in range(reps)])

    # Return the result
    return rot_mtx
281373
def rodrigues_axis_angle_rotate(x, vec, theta):
    
    x = np.array(x).T
    vec = np.array(vec).T
    theta = np.array(theta).T[...,None]

    out = np.cos(theta)*x + np.sin(theta)*np.cross(vec, x) + \
        (1 - np.cos(theta)) * (vec * x).sum(axis=-1)[...,None] * vec

    return out.T
913110
def rotateInDeclination(v1, theta_deg):
    """"""
    axis = np.array([0,-1,0])
    return rotateAroundVector(v1, axis, theta_deg)
198400
def _wrap_angle(self, theta):
        
        result = ((theta + pi) % (2*pi)) - pi
        if result == -pi: result = pi
        return result
46301
public Quaterniond fromAxisAngleDeg(Vector3dc axis, double angle) {
        return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), Math.toRadians(angle));
    }
102420
def rot2(theta):
    
    return np.array([
        [np.cos(theta), 0, -np.sin(theta)],
        [0, 1, 0],
        [np.sin(theta), 0, np.cos(theta)]
    ])