Java Code Examples for net.imglib2.realtransform.AffineTransform3D#setTranslation()

The following examples show how to use net.imglib2.realtransform.AffineTransform3D#setTranslation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TranslateAlongNormal.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public void scroll(final double step)
{
	synchronized (lock)
	{
		final double[]          delta                  = {0, 0, Math.signum(step) * translationSpeed.getAsDouble
				()};
		final AffineTransform3D affine                 = global.copy();
		final AffineTransform3D rotationAndScalingOnly = worldToSharedViewerSpace.copy();
		rotationAndScalingOnly.setTranslation(0, 0, 0);
		rotationAndScalingOnly.applyInverse(delta, delta);
		LOG.debug("Translating by delta={}", delta);
		affine.set(affine.get(0, 3) + delta[0], 0, 3);
		affine.set(affine.get(1, 3) + delta[1], 1, 3);
		affine.set(affine.get(2, 3) + delta[2], 2, 3);
		manager.setTransform(affine);
	}
}
 
Example 2
Source File: ViewFrustumTest.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
@Before
public void setUp()
{
	camera = new PerspectiveCamera(true);
	camera.setNearClip(0.1);
	camera.setFarClip(10.0);
	camera.setFieldOfView(45);
	camera.setVerticalFieldOfView(true);

	frustumCamera = new ViewFrustum(camera, new double[] {800, 600});

	cameraTransform = new AffineTransform3D();
	cameraTransform.setTranslation(0, 0, -1);

	sceneTransform = new AffineTransform3D();
	sceneTransform.set(
			-1.9735242914056459E-4, -1.0436920839427981E-4, -2.061953312972022E-4, 3.0306137875177632,
			-1.2649862727035413E-4, -1.7813723813362014E-4, 2.11240737752298E-4, 0.956379113095983,
			-1.9341029860978865E-4, 2.2300587509429097E-4, 7.223755022420857E-5, -1.1240682338705246
		);

	sourceToWorldTransform = new AffineTransform3D();
	sourceToWorldTransform.set(
			64.0, 0.0, 0.0, 3674.0,
			0.0, 64.0, 0.0, 3674.0,
			0.0, 0.0, 80.0, 1540.0
		);
}
 
Example 3
Source File: FloodFillTransformedCylinder3D.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
public FloodFillTransformedCylinder3D(
		final AffineTransform3D localToWorld,
		final double radiusX,
		final double radiusY,
		final double zRangePos,
		final double zRangeNeg)
{
	super();
	this.localToWorld = localToWorld;
	this.radiusXSquared = radiusX * radiusX;
	this.radiusYSquared = radiusY * radiusY;
	this.radiusXSquaredRadiusYSquared = radiusXSquared * radiusYSquared;
	this.zRangePos = zRangePos;
	this.zRangeNeg = zRangeNeg;

	final double[] dx = D_X_LOCAL.clone();
	final double[] dy = D_Y_LOCAL.clone();
	final double[] dz = D_Z_LOCAL.clone();

	final AffineTransform3D transformNoTranslation = this.localToWorld.copy();
	transformNoTranslation.setTranslation(0.0, 0.0, 0.0);
	transformNoTranslation.apply(dx, dx);
	transformNoTranslation.apply(dy, dy);
	transformNoTranslation.apply(dz, dz);

	this.dxx = dx[0];
	this.dxy = dx[1];
	this.dxz = dx[2];

	this.dyx = dy[0];
	this.dyy = dy[1];
	this.dyz = dy[2];

	this.dzx = dz[0];
	this.dzy = dz[1];
	this.dzz = dz[2];

	this.dxxHalf = 0.5 * dxx;
	this.dxyHalf = 0.5 * dxy;
	this.dxzHalf = 0.5 * dxz;

	this.dyxHalf = 0.5 * dyx;
	this.dyyHalf = 0.5 * dyy;
	this.dyzHalf = 0.5 * dyz;

	this.dzxHalf = 0.5 * dzx;
	this.dzyHalf = 0.5 * dzy;
	this.dzzHalf = 0.5 * dzz;

}
 
Example 4
Source File: PaintUtils.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
public static void removeTranslation(final AffineTransform3D transform)
{
	transform.setTranslation(0.0, 0.0, 0.0);
}
 
Example 5
Source File: FloodFillTransformedPlane.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
public FloodFillTransformedPlane(
		final AffineTransform3D localToWorld,
		final double minX,
		final double minY,
		final double maxX,
		final double maxY,
		final double zRangePos,
		final double zRangeNeg)
{
	super();
	this.minX = minX;
	this.minY = minY;
	this.maxX = maxX;
	this.maxY = maxY;
	this.localToWorld = localToWorld;
	this.zRangePos = zRangePos;
	this.zRangeNeg = zRangeNeg;

	final double[] dx = D_X_LOCAL.clone();
	final double[] dy = D_Y_LOCAL.clone();
	final double[] dz = D_Z_LOCAL.clone();

	final AffineTransform3D transformNoTranslation = this.localToWorld.copy();
	transformNoTranslation.setTranslation(0.0, 0.0, 0.0);
	transformNoTranslation.apply(dx, dx);
	transformNoTranslation.apply(dy, dy);
	transformNoTranslation.apply(dz, dz);

	this.dxx = dx[0];
	this.dxy = dx[1];
	this.dxz = dx[2];

	this.dyx = dy[0];
	this.dyy = dy[1];
	this.dyz = dy[2];

	this.dzx = dz[0];
	this.dzy = dz[1];
	this.dzz = dz[2];

}