Apply coordinate transformations to support scaling (s), rotation (r),
 and translation (t). Angles are specified in radians.
541475
def affine(sx, rx, ry, sy, tx, ty)
      primitive 'affine ' + format('%g,%g,%g,%g,%g,%g', sx, rx, ry, sy, tx, ty)
    end
1192746
function contoursTransform(contours, transforms) {
        if (!contours || !contours.length || !transforms || !transforms.length) {
            return contours;
        }

        var matrix = [1, 0, 0, 1, 0, 0];
        for (var i = 0, l = transforms.length; i < l; i++) {
            var transform = transforms[i];
            var params = transform.params;
            switch (transform.name) {
                case 'translate':
                    matrix = matrixUtil.mul(matrix, [1, 0, 0, 1, params[0], params[1]]);
                    break;
                case 'scale':
                    matrix = matrixUtil.mul(matrix, [params[0], 0, 0, params[1], 0, 0]);
                    break;
                case 'matrix':
                    matrix = matrixUtil.mul(matrix,
                        [params[0], params[1], params[2], params[3], params[4], params[5]]);
                    break;
                case 'rotate':
                    var radian = params[0] * Math.PI / 180;
                    if (params.length > 1) {

                        matrix = matrixUtil.multiply(
                            matrix,
                            [1, 0, 0, 1, -params[1], -params[2]],
                            [Math.cos(radian), Math.sin(radian), -Math.sin(radian), Math.cos(radian), 0, 0],
                            [1, 0, 0, 1, params[1], params[2]]
                        );
                    }
                    else {
                        matrix = matrixUtil.mul(
                            matrix, [Math.cos(radian), Math.sin(radian), -Math.sin(radian), Math.cos(radian), 0, 0]);
                    }
                    break;
                case 'skewX':
                    matrix = matrixUtil.mul(matrix,
                        [1, 0, Math.tan(params[0] * Math.PI / 180), 1, 0, 0]);
                    break;
                case 'skewY':
                    matrix = matrixUtil.mul(matrix,
                        [1, Math.tan(params[0] * Math.PI / 180), 0, 1, 0, 0]);
                    break;
            }
        }

        contours.forEach(function (p) {
            pathTransform(p, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
        });

        return contours;
    }
996553
function() {
            this.x = this.body.p.x;
            this.y = this.body.p.y;
            this.rotation = this.body.a * RAD2DEG;
        }
1239711
def rotate(self, azimuth, axis=None):
        
        target = self._target

        y_axis = self._n_pose[:3, 1].flatten()
        if axis is not None:
            y_axis = axis
        x_rot_mat = transformations.rotation_matrix(azimuth, y_axis, target)
        self._n_pose = x_rot_mat.dot(self._n_pose)

        y_axis = self._pose[:3, 1].flatten()
        if axis is not None:
            y_axis = axis
        x_rot_mat = transformations.rotation_matrix(azimuth, y_axis, target)
        self._pose = x_rot_mat.dot(self._pose)
533893
def from_radians(cls, lat_radians, long_radians):
        '''
        
        '''
        return cls(math.degrees(lat_radians), math.degrees(long_radians))
904884
public void rotateByAxis(float angle, float x, float y, float z) {
        NativeTransform.rotateByAxis(getNative(), angle * TO_RADIANS, x, y, z);
    }
11323
public void rotate(Quaternion rotation, Point3D pivot) {
		Point3D currentPivot = getPivot();
    	// Update the plane equation according
    	// to the desired normal (computed from
    	// the identity vector and the rotations).
    	Transform3D m = new Transform3D();
    	m.setRotation(rotation);
    	Vector3f v = new Vector3f(this.getEquationComponentA(),this.getEquationComponentB(),this.getEquationComponentC());
    	m.transform(v);
    	this.setEquationComponentA(v.getX());
    	this.setEquationComponentB(v.getY());
    	this.setEquationComponentC(v.getZ());
    	
    	if (pivot==null) {
	    	// a.x + b.y + c.z + d = 0
	    	// where (x,y,z) is the translation point
	    	this.setEquationComponentD( - (this.getEquationComponentA()*currentPivot.getX() +
	    				this.getEquationComponentB()*currentPivot.getY() +
	    				this.getEquationComponentC()*currentPivot.getZ()));
    	}
    	else {
    		// Compute the new point
    		Point3f nP = new Point3f(
    				currentPivot.getX() - pivot.getX(),
    				currentPivot.getY() - pivot.getY(),
    				currentPivot.getZ() - pivot.getZ());
    		m.transform(nP);
    		nP.setX(nP.getX() + pivot.getX());
    		nP.setY(nP.getY() + pivot.getY());
    		nP.setZ(nP.getZ() + pivot.getZ());
    		
	    	// a.x + b.y + c.z + d = 0
	    	// where (x,y,z) is the translation point
	    	this.setEquationComponentD( - (this.getEquationComponentA()*nP.getX() +
	    				this.getEquationComponentB()*nP.getY() +
	    				this.getEquationComponentC()*nP.getZ()));
    	}
    	
		clearBufferedValues();
	}
597161
public void rotate(double angle_in_Radians) {
		Transformation2D temp = new Transformation2D();
		temp.setRotate(angle_in_Radians);
		multiply(temp);
	}
868346
def _rotate(self, angles, dj_matrix, gm=None, r0=None, omega=None):
        """"""
        if dj_matrix is None:
            dj_matrix = _shtools.djpi2(self.lmax + 1)

        # The coefficients need to be 4pi normalized with csphase = 1
        coeffs = _shtools.SHRotateRealCoef(
            self.to_array(normalization='4pi', csphase=1), angles, dj_matrix)

        # Convert 4pi normalized coefficients to the same normalization
        # as the unrotated coefficients.
        if self.normalization != '4pi' or self.csphase != 1:
            temp = _convert(coeffs, normalization_in='4pi', csphase=1,
                            normalization_out=self.normalization,
                            csphase_out=self.csphase)
            return SHGravCoeffs.from_array(
                temp, normalization=self.normalization,
                csphase=self.csphase, copy=False, gm=gm, r0=r0, omega=omega)
        else:
            return SHGravCoeffs.from_array(coeffs, gm=gm, r0=r0, omega=omega,
                                           copy=False)
499163
public Matrix3 setToTransform (IVector translation, double rotation, IVector scale) {
        double sx = scale.x(), sy = scale.y();
        return setToRotation(rotation).set(m00 * sx, m10 * sy, translation.x(),
                                           m01 * sx, m11 * sy, translation.y(),
                                           0f, 0f, 1f);
    }
486455
public static Point transform (float x, float y, float sx, float sy, float rotation,
                                   float tx, float ty, Point result) {
        return transform(x, y, sx, sy, FloatMath.sin(rotation), FloatMath.cos(rotation), tx, ty,
                         result);
    }
1223155
function(scale,originX,originY) {
            originX = originX || 0;
            originY = originY || 0;
            return new Matrix(this.mtx && this.mtx.translate(originX,originY).scale(scale).translate(-originX,-originY));
        }
226757
function _rotateCanvas(ctx, params, transforms) {

	// Get conversion factor for radians
	params._toRad = (params.inDegrees ? (PI / 180) : 1);

	// Rotate canvas using shape as center of rotation
	ctx.translate(params.x, params.y);
	ctx.rotate(params.rotate * params._toRad);
	ctx.translate(-params.x, -params.y);

	// If transformation data was given
	if (transforms) {
		// Update transformation data
		transforms.rotate += (params.rotate * params._toRad);
	}
}
122795
public static void reproject( CoordinateReferenceSystem from, CoordinateReferenceSystem to, Coordinate[] coordinates )
            throws Exception {
        MathTransform mathTransform = CRS.findMathTransform(from, to);

        for( int i = 0; i < coordinates.length; i++ ) {
            coordinates[i] = JTS.transform(coordinates[i], coordinates[i], mathTransform);
        }
    }
98271
private void setEAxis() {
		Rotation e = rotations.get(0);
		Rotation h = rotations.get(principalAxisIndex);
		e.setAxisAngle(new AxisAngle4d(h.getAxisAngle()));
		e.getAxisAngle().angle = 0.0;
		e.setFold(h.getFold());
	}
388806
@Override
	protected void doTransform(ITransformable.Rotate transformable, float comp)
	{
		float from = reversed ? toAngle : fromAngle;
		float to = reversed ? fromAngle : toAngle;
		transformable.rotate(from + (to - from) * comp, axisX, axisY, axisZ, offsetX, offsetY, offsetZ);
	}
831290
def rotate(angle, axis, dtype=None):
    
    angle = np.radians(angle)
    assert len(axis) == 3
    x, y, z = axis / np.linalg.norm(axis)
    c, s = math.cos(angle), math.sin(angle)
    cx, cy, cz = (1 - c) * x, (1 - c) * y, (1 - c) * z
    M = np.array([[cx * x + c, cy * x - z * s, cz * x + y * s, .0],
                  [cx * y + z * s, cy * y + c, cz * y - x * s, 0.],
                  [cx * z - y * s, cy * z + x * s, cz * z + c, 0.],
                  [0., 0., 0., 1.]], dtype).T
    return M