/* (non-Javadoc)
@see org.joml.Matrix3x2fc#scaleAroundLocal(float, float, float, org.joml.Matrix3x2f)
552394
public Matrix3x2f scaleAroundLocal(float factor, float ox, float oy, Matrix3x2f dest) {
        return scaleAroundLocal(factor, factor, ox, oy, dest);
    }
1224945
public Matrix3f scale(Vector3fc xyz, Matrix3f dest) {
        return scale(xyz.x(), xyz.y(), xyz.z(), dest);
    }
253889
public static void scale_row( final int blockLength ,
                                  final DSubmatrixD1 Y ,
                                  final DSubmatrixD1 W ,
                                  final int row ,
                                  final int zeroOffset,
                                  final double val ) {


        int offset = row+zeroOffset;

        if( offset >= W.col1-W.col0 )
            return;
        
        // handle the one
        W.set(row,offset,val);

        // scale rest of the vector
        VectorOps_DDRB.scale_row(blockLength,Y,row,val,W,row,offset+1,Y.col1-Y.col0);
    }
395299
public Matrix4x3f scale(float xyz, Matrix4x3f dest) {
        return scale(xyz, xyz, xyz, dest);
    }
315244
public static void scale(double scalar, DMatrixSparseCSC A, DMatrixSparseCSC B) {
        if( A != B ) {
            B.copyStructure(A);

            for(int i = 0; i < A.nz_length; i++ ) {
                B.nz_values[i] = A.nz_values[i]*scalar;
            }
        } else {
            for(int i = 0; i < A.nz_length; i++ ) {
                B.nz_values[i] *= scalar;
            }
        }
    }
454065
private static void adjustUncalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
										   RectangleLength2D_F64 bound, double scale) {
		// translation
		double deltaX = -bound.x0*scale;
		double deltaY = -bound.y0*scale;

		// adjustment matrix
		SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
		SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
		SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);

		rectifyLeft.set(A.mult(rL).getDDRM());
		rectifyRight.set(A.mult(rR).getDDRM());
	}
329541
public Matrix4f scaleLocal(float xyz, Matrix4f dest) {
        return scaleLocal(xyz, xyz, xyz, dest);
    }
587615
public Matrix4x3f scale(Vector3fc xyz, Matrix4x3f dest) {
        return scale(xyz.x(), xyz.y(), xyz.z(), dest);
    }
979782
public Matrix4f scaleLocal(float x, float y, float z, Matrix4f dest) {
        if ((properties & PROPERTY_IDENTITY) != 0)
            return dest.scaling(x, y, z);
        return scaleLocalGeneric(x, y, z, dest);
    }
508434
public static BigDecimal inverse(final BigDecimal value, final int scale) {
        return inverse(value, scale, BigDecimal.ROUND_HALF_UP);
    }
1294322
function toLocalPoint(globalPosition) {

    var viewbox = canvas.viewbox();

    var clientRect = canvas._container.getBoundingClientRect();

    return {
      x: viewbox.x + (globalPosition.x - clientRect.left) / viewbox.scale,
      y: viewbox.y + (globalPosition.y - clientRect.top) / viewbox.scale
    };
  }
642986
@Override
	protected boolean setFrame(int l, int t, int r, int b) {
		if (getDrawable() == null) {
			return super.setFrame(l, t, r, b);
		}
		Matrix matrix = getImageMatrix();
		float scaleFactor = getWidth() / (float) getDrawable().getIntrinsicWidth();
		matrix.setScale(scaleFactor, scaleFactor, 0, 0);
		setImageMatrix(matrix);
		return super.setFrame(l, t, r, b);
	}
274843
@Override
	public void scale(float x, float y, float z, float offsetX, float offsetY, float offsetZ)
	{
		translate(offsetX, offsetY, offsetZ);
		transformMatrix.scale(new Vector3f(x, y, z));
		translate(-offsetX, -offsetY, -offsetZ);
	}
939654
private static void scaleDownTenRoundUp(Slice decimal, int tenScale, Slice result)
    {
        boolean round;
        do {
            int powerTen = Math.min(tenScale, MAX_POWER_OF_TEN_INT);
            tenScale -= powerTen;

            int divisor = POWERS_OF_TEN_INT[powerTen];
            round = divideCheckRound(decimal, divisor, result);
            decimal = result;
        }
        while (tenScale > 0);

        if (round) {
            incrementUnsafe(decimal);
        }
    }
690954
@Override
  public double[] projectRelativeDataToScaledSpace(NumberVector data) {
    final int dim = data.getDimensionality();
    double[] vec = new double[dim];
    for(int d = 0; d < dim; d++) {
      vec[d] = scales[d].getRelativeScaled(data.doubleValue(d));
    }
    return vec;
  }
403762
public void recalculateScale() throws SlickException {
		targetWidth = container.getWidth();
		targetHeight = container.getHeight();
		
		if (maintainAspect) {
			boolean normalIsWide = (normalWidth / normalHeight > 1.6 ? true : false);
			boolean containerIsWide = ((float) targetWidth / (float) targetHeight > 1.6 ? true : false);
			float wScale = targetWidth / normalWidth;
			float hScale = targetHeight / normalHeight;

			if (normalIsWide & containerIsWide) {
				float scale = (wScale < hScale ? wScale : hScale);
				targetWidth = (int) (normalWidth * scale);
				targetHeight = (int) (normalHeight * scale);
			} else if (normalIsWide & !containerIsWide) {
				targetWidth = (int) (normalWidth * wScale);
				targetHeight = (int) (normalHeight * wScale);
			} else if (!normalIsWide & containerIsWide) {
				targetWidth = (int) (normalWidth * hScale);
				targetHeight = (int) (normalHeight * hScale);
			} else {
				float scale = (wScale < hScale ? wScale : hScale);
				targetWidth = (int) (normalWidth * scale);
				targetHeight = (int) (normalHeight * scale);
			}

		} 
		
		if (held instanceof InputListener) {
			container.getInput().addListener((InputListener) held);
		}
		container.getInput().setScale(normalWidth / targetWidth,
									  normalHeight / targetHeight);
		

		int yoffset = 0;
		int xoffset = 0;
		
		if (targetHeight < container.getHeight()) {
			yoffset = (container.getHeight() - targetHeight) / 2;
		}
		if (targetWidth < container.getWidth()) {
			xoffset = (container.getWidth() - targetWidth) / 2;
		}
		container.getInput().setOffset(-xoffset / (targetWidth / normalWidth), 
									   -yoffset / (targetHeight / normalHeight));
		
	}
118322
public void scale(float scale) {
        if (scale != 1.0f) {
            left = (int) (left * scale + 0.5f);
            top = (int) (top * scale + 0.5f);
            right = (int) (right * scale + 0.5f);
            bottom = (int) (bottom * scale + 0.5f);
        }
    }