/* (non-Javadoc)
@see org.joml.Matrix4x3fc#transformAab(float, float, float, float, float, float, org.joml.Vector3f, org.joml.Vector3f)
430929
public Matrix4x3f transformAab(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, Vector3f outMin, Vector3f outMax) {
        float xax = m00 * minX, xay = m01 * minX, xaz = m02 * minX;
        float xbx = m00 * maxX, xby = m01 * maxX, xbz = m02 * maxX;
        float yax = m10 * minY, yay = m11 * minY, yaz = m12 * minY;
        float ybx = m10 * maxY, yby = m11 * maxY, ybz = m12 * maxY;
        float zax = m20 * minZ, zay = m21 * minZ, zaz = m22 * minZ;
        float zbx = m20 * maxZ, zby = m21 * maxZ, zbz = m22 * maxZ;
        float xminx, xminy, xminz, yminx, yminy, yminz, zminx, zminy, zminz;
        float xmaxx, xmaxy, xmaxz, ymaxx, ymaxy, ymaxz, zmaxx, zmaxy, zmaxz;
        if (xax < xbx) {
            xminx = xax;
            xmaxx = xbx;
        } else {
            xminx = xbx;
            xmaxx = xax;
        }
        if (xay < xby) {
            xminy = xay;
            xmaxy = xby;
        } else {
            xminy = xby;
            xmaxy = xay;
        }
        if (xaz < xbz) {
            xminz = xaz;
            xmaxz = xbz;
        } else {
            xminz = xbz;
            xmaxz = xaz;
        }
        if (yax < ybx) {
            yminx = yax;
            ymaxx = ybx;
        } else {
            yminx = ybx;
            ymaxx = yax;
        }
        if (yay < yby) {
            yminy = yay;
            ymaxy = yby;
        } else {
            yminy = yby;
            ymaxy = yay;
        }
        if (yaz < ybz) {
            yminz = yaz;
            ymaxz = ybz;
        } else {
            yminz = ybz;
            ymaxz = yaz;
        }
        if (zax < zbx) {
            zminx = zax;
            zmaxx = zbx;
        } else {
            zminx = zbx;
            zmaxx = zax;
        }
        if (zay < zby) {
            zminy = zay;
            zmaxy = zby;
        } else {
            zminy = zby;
            zmaxy = zay;
        }
        if (zaz < zbz) {
            zminz = zaz;
            zmaxz = zbz;
        } else {
            zminz = zbz;
            zmaxz = zaz;
        }
        outMin.x = xminx + yminx + zminx + m30;
        outMin.y = xminy + yminy + zminy + m31;
        outMin.z = xminz + yminz + zminz + m32;
        outMax.x = xmaxx + ymaxx + zmaxx + m30;
        outMax.y = xmaxy + ymaxy + zmaxy + m31;
        outMax.z = xmaxz + ymaxz + zmaxz + m32;
        return this;
    }
1346040
public Matrix4x3d translation(Vector3fc offset) {
        return translation(offset.x(), offset.y(), offset.z());
    }
19991
public Bbox transform(Matrix t) {
		Coordinate c1 = transform(t, new Coordinate(x, y));
		Coordinate c2 = transform(t, new Coordinate(x + width, y + height));
		Coordinate origin = new Coordinate(Math.min(c1.getX(), c2.getX()), Math.min(c1.getY(), c2.getY()));
		Coordinate endPoint = new Coordinate(Math.max(c1.getX(), c2.getX()), Math.max(c1.getY(), c2.getY()));
		return new Bbox(origin.getX(), origin.getY(), endPoint.getX() - origin.getX(), endPoint.getY() - origin.getY());
	}
1179107
public Vector3f transform(Vector3f vec){
        return transform(vec.x, vec.y, vec.z, vec);
    }
1235805
public void transform(Transform3D transform, Point3D pivot) {
		Point3D refPoint = (pivot == null) ? getPivot() : pivot;
		Vector3f v = new Vector3f(this.getEquationComponentA(),this.getEquationComponentB(),this.getEquationComponentC());
    	transform.transform(v);

    	// Update the plane equation according
    	// to the desired normal (computed from
    	// the identity vector and the rotations).
    	
    	// a.x + b.y + c.z + d = 0
    	// where (x,y,z) is the translation point
    	
    	
    	this.set(v.getX(),v.getY(),v.getZ(),- (this.getEquationComponentA()*(refPoint.getX()+transform.m03) +
    				this.getEquationComponentB()*(refPoint.getY()+transform.m13) +
    				this.getEquationComponentC()*(refPoint.getZ()+transform.m23)));
    	
		clearBufferedValues();
	}
1208075
public FDistort affine(double a11, double a12, double a21, double a22,
						   double dx, double dy) {

		PixelTransformAffine_F32 transform;

		if( outputToInput != null && outputToInput instanceof PixelTransformAffine_F32 ) {
			transform = (PixelTransformAffine_F32)outputToInput;
		} else {
			transform = new PixelTransformAffine_F32();
		}

		Affine2D_F32 m = new Affine2D_F32();

		m.a11 = (float)a11;
		m.a12 = (float)a12;
		m.a21 = (float)a21;
		m.a22 = (float)a22;
		m.tx = (float)dx;
		m.ty = (float)dy;

		m.invert(transform.getModel());

		return transform(transform);
	}
71609
public static <T extends ImageGray<T>>
	void applyTransform( T input , int transform[] , int minValue , T output ) {
		InputSanityCheck.checkSameShape(input, output);

		if( input instanceof GrayU8) {
			EnhanceImageOps.applyTransform((GrayU8) input, transform, (GrayU8) output);
		} else if( input instanceof GrayS8) {
			EnhanceImageOps.applyTransform((GrayS8)input,transform,minValue,(GrayS8)output);
		} else if( input instanceof GrayU16) {
			EnhanceImageOps.applyTransform((GrayU16)input,transform,(GrayU16)output);
		} else if( input instanceof GrayS16) {
			EnhanceImageOps.applyTransform((GrayS16)input,transform,minValue,(GrayS16)output);
		} else if( input instanceof GrayS32) {
			EnhanceImageOps.applyTransform((GrayS32)input,transform,minValue,(GrayS32)output);
		} else {
			throw new IllegalArgumentException("Image type not supported. "+input.getClass().getSimpleName());
		}
	}
1021803
void applyTransformation(Transformation2D transform) {
		m_vertices_mp.applyTransformation(transform);
		if (m_segments != null) {
			for (int i = 0, n = m_segments.size(); i < n; i++) {
				if (m_segments.get(i) != null) {
					m_segments.get(i).applyTransformation(transform);
				}
			}
		}
	}
1304079
public Vector3f absolute(Vector3f dest) {
        dest.x = Math.abs(this.x);
        dest.y = Math.abs(this.y);
        dest.z = Math.abs(this.z);
        return dest;
    }
257227
@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	protected void doTransform(ITransformable transformable, float comp)
	{
		if (listTransformations.size() == 0)
			return;

		if (reversed)
			elapsedTimeCurrentLoop = Math.max(0, duration - elapsedTimeCurrentLoop);
		for (Transformation transformation : listTransformations)
		{
			transformation.transform(transformable, elapsedTimeCurrentLoop);
			elapsedTimeCurrentLoop -= transformation.totalDuration();
		}
	}
341611
public static AxisAlignedBB rotate(AxisAlignedBB aabb, EnumFacing dir)
	{
		if (dir == EnumFacing.SOUTH)
			return aabb;

		int angle = dir.getAxis() == Axis.Y ? dir.getAxisDirection().getOffset() : EnumFacingUtils.getRotationCount(dir);
		Axis axis = dir.getAxis() == Axis.Y ? Axis.X : Axis.Y;

		return rotate(aabb, angle, axis);
	}
169906
private static void transformOrigPDB(int n, int[] res1, int[] res2,
			Atom[] ca1, Atom[] ca2, AFPChain afpChain, int blockNr)
			throws StructureException {
		logger.debug(
				"transforming original coordinates {} len1: {} res1: {} len2: {} res2: {}",
				n, ca1.length, res1.length, ca2.length, res2.length);

		Atom[] cod1 = getAtoms(ca1, res1, n, false);
		Atom[] cod2 = getAtoms(ca2, res2, n, false);

		// double *cod1 = pro1->Cod4Res(n, res1);
		// double *cod2 = pro2->Cod4Res(n, res2);

		Matrix4d transform = SuperPositions.superpose(Calc.atomsToPoints(cod1),
				Calc.atomsToPoints(cod2));

		Matrix r = Matrices.getRotationJAMA(transform);
		Atom t = Calc.getTranslationVector(transform);

		logger.debug("transPdb: transforming orig coordinates with matrix: {}",
				r);

		if (afpChain != null) {
			Matrix[] ms = afpChain.getBlockRotationMatrix();
			if (ms == null)
				ms = new Matrix[afpChain.getBlockNum()];

			ms[blockNr] = r;

			Atom[] shifts = afpChain.getBlockShiftVector();
			if (shifts == null)
				shifts = new Atom[afpChain.getBlockNum()];
			shifts[blockNr] = t;

			afpChain.setBlockRotationMatrix(ms);
			afpChain.setBlockShiftVector(shifts);
		}

		for (Atom a : ca2)
			Calc.transform(a.getGroup(), transform);

	}
902024
public static AxisAlignedBB rotate(AxisAlignedBB aabb, int angle)
	{
		return rotate(aabb, angle, Axis.Y);
	}
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);
	}
893763
public Vector3f transformPosition(Vector3fc v, Vector3f dest) {
        return transformPosition(v.x(), v.y(), v.z(), dest);
    }
896220
@Override
	protected void doTransform(ITransformable.Alpha transformable, float comp)
	{
		if (comp <= 0)
			return;

		float from = reversed ? toAlpha : fromAlpha;
		float to = reversed ? fromAlpha : toAlpha;

		transformable.setAlpha((int) (from + (to - from) * comp));
	}
78390
@Override
	public void transform(Transform3D transform) {
		if (transform!=null) {
			Point3D p = new Point3f();
			for(int i=0; i<this.numCoords;) {
				p.set(this.coords[i], this.coords[i+1], this.coords[i+2]);
				transform.transform(p);
				this.coords[i++] = p.getX();
				this.coords[i++] = p.getY();
				this.coords[i++] = p.getZ();
			}
			this.graphicalBounds = null;
			this.logicalBounds = null;
		}
	}