Return the translation of scaled world coordinates to coordinates relative to the pan origin.

@return transformation matrix
431908
public Matrix getWorldToPanTranslation() {
		if (viewState.getScale() > 0) {
			double dX = -(viewState.getPanX() * viewState.getScale());
			double dY = viewState.getPanY() * viewState.getScale();
			return new Matrix(1, 0, 0, 1, dX, dY);
		}
		return new Matrix(1, 0, 0, 1, 0, 0);
	}
128713
public Matrix4f getMatrix() {
        if (updateMatrix) {
            final Matrix4f matrix = Matrix4f.createScaling(scale.toVector4(1)).rotate(rotation).translate(position);
            if (parent == null) {
                this.matrix = matrix;
            } else {
                childMatrix = matrix;
            }
            updateMatrix = false;
        }
        if (parent != null) {
            final Matrix4f parentMatrix = parent.getMatrix();
            if (parentMatrix != lastParentMatrix) {
                matrix = parentMatrix.mul(childMatrix);
                lastParentMatrix = parentMatrix;
            }
        }
        return matrix;
    }
652902
@Override
	public String getDefaultOrientation() {
		StringBuilder s = new StringBuilder();
		s.append(setCentroid());

		// calculate  orientation
		Quat4d q = new Quat4d();
		q.set(polyhedron.getViewMatrix(0));
		q.normalize();
		Quat4d r = new Quat4d();
		r.set(rotationAxisAligner.getRotationMatrix());
		r.normalize();
		q.mul(r);
		q.normalize();

		// set orientation
		s.append("moveto 0 quaternion{");
		s.append(jMolFloat(q.x));
		s.append(",");
		s.append(jMolFloat(q.y));
		s.append(",");
		s.append(jMolFloat(q.z));
		s.append(",");
		s.append(jMolFloat(q.w));
		s.append("};");
		return s.toString();
	}
992548
function transformSkew($angle_x, $angle_y, $x = '', $y = '', $returnstring = false)
	{
		if ($x === '') {
			$x = $this->x;
		}

		if ($y === '') {
			$y = $this->y;
		}

		$angle_x = -$angle_x;
		$angle_y = -$angle_y;

		$x *= Mpdf::SCALE;
		$y = ($this->h - $y) * Mpdf::SCALE;

		// calculate elements of transformation matrix
		$tm = [];
		$tm[0] = 1;
		$tm[1] = tan(deg2rad($angle_y));
		$tm[2] = tan(deg2rad($angle_x));
		$tm[3] = 1;
		$tm[4] = -$tm[2] * $y;
		$tm[5] = -$tm[1] * $x;

		// skew the coordinate system
		if ($returnstring) {
			return $this->_transform($tm, true);
		} else {
			$this->_transform($tm);
		}
	}
1342442
public Matrix calcOrig() {
		if (!Coordinates.equals(getSource().getSize(), getSize())) {
			throw new RuntimeException(
					"Cannot change Matrix size. Use calc(Ret.NEW) or calc(Ret.LINK) instead.");
		}
		long[] newCoordinates = new long[position.length];
		for (long[] c : newContent.allCoordinates()) {
			Coordinates.plus(newCoordinates, position, c);
			getSource().setAsObject(getObject(newCoordinates), newCoordinates);
		}
		getSource().fireValueChanged();
		return getSource();
	}
877251
@Override
  public void getTransform(Matrix transform) {
    if (mTransformCallback != null) {
      mTransformCallback.getTransform(transform);
    } else {
      transform.reset();
    }
  }
1353138
function () {
		return {
			translateX: this.xAxis ? this.xAxis.left : this.chart.plotLeft, 
			translateY: this.yAxis ? this.yAxis.top : this.chart.plotTop,
			scaleX: 1, // #1623
			scaleY: 1
		};
	}
227173
def get_transform(self):
        
        return _InterpolatedInverseTransform(transform=self._transform,
                                             smin=0,
                                             smax=self._transform._M)
58469
function(angle,originX,originY) {
            
            if (angle == null) return this.decompose(this.mtx).rotate;
            
            originX = originX || 0;
            originY = originY || 0;
            
            var mtx = this.decompose();
            
            return new Matrix(this.mtx && this.mtx.translate(originX,originY)
                    .scaleNonUniform(1/mtx.scaleX,1/mtx.scaleY)
                    .rotate(angle)
                    .scaleNonUniform(mtx.scaleX,mtx.scaleY)
                    .translate(-originX,-originY));
        }
132243
public static AffineTransform getWorldToPixel( Envelope worldEnvelope, Rectangle pixelRectangle ) {
        double width = pixelRectangle.getWidth();
        double worldWidth = worldEnvelope.getWidth();
        double height = pixelRectangle.getHeight();
        double worldHeight = worldEnvelope.getHeight();

        AffineTransform translate = AffineTransform.getTranslateInstance(-worldEnvelope.getMinX(), -worldEnvelope.getMinY());
        AffineTransform scale = AffineTransform.getScaleInstance(width / worldWidth, height / worldHeight);
        AffineTransform mirror_y = new AffineTransform(1, 0, 0, -1, 0, pixelRectangle.getHeight());
        AffineTransform world2pixel = new AffineTransform(mirror_y);
        world2pixel.concatenate(scale);
        world2pixel.concatenate(translate);
        return world2pixel;
    }
1189388
public Matrix4f getFinalTransformMatrix()
    {
        final FloatBuffer fb = ByteBuffer.allocateDirect(4*4*4).order(ByteOrder.nativeOrder()).asFloatBuffer();
        NativeBone.getFinalTransformMatrix(getNative(), fb);
        return new Matrix4f(fb);
    }
1107441
def _get_scale(self):
        
        sx, sxy, syx, sy, ox, oy = self.transformation
        return sx, sy
793895
public AffineTransform metersToTilePixelsTransform(int tx, int ty, int zoomLevel) {
        AffineTransform result = new AffineTransform();
        double scale = 1.0 / resolution(zoomLevel);
        int nTiles = 2 << (zoomLevel - 1);
        int px = tx * -256;
        int py = (nTiles - ty) * -256;
        // flip y for upper-left origin
        result.scale(1, -1);
        result.translate(px, py);
        result.scale(scale, scale);
        result.translate(originShift, originShift);
        return result;
    }
566833
function parseTransforms(value) {
  return value
    .match(/(rotate|translate|scale|skewX|skewY|matrix)\s*\(([^)]*)\)\s*/g)
    .map(transform => transform.match(/[\w.-]+/g));
}
763001
public static AffineTransformation axisProjection(int dim, int ax1, int ax2) {
    // setup a projection to get the data into the interval -1:+1 in each
    // dimension with the intended-to-see dimensions first.
    AffineTransformation proj = AffineTransformation.reorderAxesTransformation(dim, ax1, ax2);
    // Assuming that the data was normalized on [0:1], center it:
    double[] trans = new double[dim];
    for(int i = 0; i < dim; i++) {
      trans[i] = -.5;
    }
    proj.addTranslation(trans);
    // mirror on the y axis, since the SVG coordinate system is screen
    // coordinates (y = down) and not mathematical coordinates (y = up)
    proj.addAxisReflection(2);
    // scale it up
    proj.addScaling(SCALE);

    return proj;
  }
1296201
public Matrix4d getRepeatTransform(int x, int y){

		Matrix4d transform = new Matrix4d();
		transform.setIdentity();

		int[] iCounts = getAxisCounts(x);
		int[] jCounts = getAxisCounts(y);

		int[] counts = new int[iCounts.length];
		for (int k = 0; k < iCounts.length; k++)
			counts[k] = iCounts[k] - jCounts[k];

		for(int t = counts.length-1; t>=0; t--) {
			if(counts[t] == 0)
				continue;
			if (counts[t] > 0) {
				Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
				for(int i=0;i<counts[t];i++)
					transform.mul(axis);
			} else if (counts[t] < 0) {
				Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
				axis.invert();
				for(int i=0;i<counts[t];i++)
					transform.mul(axis);
			}
		}
		return transform;
	}
1188249
public Matrix getRotationMatrix(double theta) {
		if( rotationAxis == null) {
			// special case for pure translational axes
			return Matrix.identity(3, 3);
		}
		double x = rotationAxis.getX();
		double y = rotationAxis.getY();
		double z = rotationAxis.getZ();
		double cos = Math.cos(theta);
		double sin = Math.sin(theta);
		double com = 1 - cos;
		return new Matrix(new double[][] {
				{com*x*x + cos, com*x*y+sin*z, com*x*z+-sin*y},
				{com*x*y-sin*z, com*y*y+cos, com*y*z+sin*x},
				{com*x*z+sin*y, com*y*z-sin*x, com*z*z+cos},
		});
	}