当前位置: 首页>>代码示例>>Java>>正文


Java LinAlgHelpers.subtract方法代码示例

本文整理汇总了Java中net.imglib2.util.LinAlgHelpers.subtract方法的典型用法代码示例。如果您正苦于以下问题:Java LinAlgHelpers.subtract方法的具体用法?Java LinAlgHelpers.subtract怎么用?Java LinAlgHelpers.subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.imglib2.util.LinAlgHelpers的用法示例。


在下文中一共展示了LinAlgHelpers.subtract方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import net.imglib2.util.LinAlgHelpers; //导入方法依赖的package包/类
protected void paint( final int x1, final int y1, final int x2, final int y2 )
{
	final double[] p1 = { x1, y1 };
	final double[] p2 = { x2, y2 };
	LinAlgHelpers.subtract( p2, p1, p2 );

	final double l = LinAlgHelpers.length( p2 );
	LinAlgHelpers.normalize( p2 );

	System.out.println( x1 + " " + y1 + ", " + x2 + " " + y2 + ", " + l );
	long xOld = Math.round( p1[ 0 ] ), yOld = Math.round( p1[ 1 ] );
	for ( int i = 1; i < l; ++i )
	{

		LinAlgHelpers.add( p1, p2, p1 );
		final long x = Math.round( p1[ 0 ] ), y = Math.round( p1[ 1 ] );
		if ( x != xOld || y != yOld )
		{
			paint( ( int ) x, ( int ) y );
			xOld = x;
			yOld = y;
		}
	}
	paint( x2, y2 );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:26,代码来源:DrawProjectAndIntersectController.java

示例2: paint

import net.imglib2.util.LinAlgHelpers; //导入方法依赖的package包/类
protected void paint( final int x1, final int y1, final int x2, final int y2 )
{
	setCoordinates( x1, y1 );
	final double[] p1 = new double[ 3 ];
	final RealPoint rp1 = RealPoint.wrap( p1 );
	labelLocation.localize( p1 );

	setCoordinates( x2, y2 );
	final double[] d = new double[ 3 ];
	labelLocation.localize( d );

	LinAlgHelpers.subtract( d, p1, d );

	final double l = LinAlgHelpers.length( d );
	LinAlgHelpers.normalize( d );

	for ( int i = 1; i < l; ++i )
	{
		LinAlgHelpers.add( p1, d, p1 );
		paint( rp1 );
	}
	paint( labelLocation );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:24,代码来源:LabelBrushController.java

示例3: SimilarityTransformAnimator3D

import net.imglib2.util.LinAlgHelpers; //导入方法依赖的package包/类
public SimilarityTransformAnimator3D( final AffineTransform3D transformStart, final AffineTransform3D transformEnd, final double cX, final double cY, final long duration )
{
	super( duration );
	this.cX = cX;
	this.cY = cY;

	qStart = new double[ 4 ];
	final double[] qStartInv = new double[ 4 ];
	final double[] qEnd = new double[ 4 ];
	final double[] qEndInv = new double[ 4 ];
	qDiff = new double[ 4 ];
	Affine3DHelpers.extractRotation( transformStart, qStart );
	LinAlgHelpers.quaternionInvert( qStart, qStartInv );

	Affine3DHelpers.extractRotation( transformEnd, qEnd );
	LinAlgHelpers.quaternionInvert( qEnd, qEndInv );

	LinAlgHelpers.quaternionMultiply( qStartInv, qEnd, qDiff );
	if ( qDiff[ 0 ] < 0 )
		LinAlgHelpers.scale( qDiff, -1, qDiff );

	scaleStart = Affine3DHelpers.extractScale( transformStart, 0 );
	scaleEnd = Affine3DHelpers.extractScale( transformEnd, 0 );
	scaleDiff = scaleEnd - scaleStart;

	final double[] tStart = new double[ 3 ];
	final double[] tEnd = new double[ 3 ];
	for ( int d = 0; d < 3; ++d )
	{
		tStart[ d ] = transformStart.get( d, 3 ) / scaleStart;
		tEnd[ d ] = transformEnd.get( d, 3 ) / scaleEnd;
	}

	xg0Start = new double[3];
	final double[] xg0End = new double[3];
	xg0Diff = new double[3];

	final double[][] R = new double[ 3 ][ 3 ];
	LinAlgHelpers.quaternionToR( qStartInv, R );
	LinAlgHelpers.mult( R, tStart, xg0Start );
	LinAlgHelpers.scale( xg0Start, -1, xg0Start );
	LinAlgHelpers.quaternionToR( qEndInv, R );
	LinAlgHelpers.mult( R, tEnd, xg0End );
	LinAlgHelpers.scale( xg0End, -1, xg0End );
	LinAlgHelpers.subtract( xg0End, xg0Start, xg0Diff );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:47,代码来源:SimilarityTransformAnimator3D.java

示例4: SimilarityTransformAnimator2D

import net.imglib2.util.LinAlgHelpers; //导入方法依赖的package包/类
public SimilarityTransformAnimator2D( final AffineTransform3D transformStart, final AffineTransform3D transformEnd, final double cX, final double cY, final long duration )
{
	super( duration );
	
	startAngle = Rotation2DHelpers.extractRotation( transformStart );
	final double endAngle = Rotation2DHelpers.extractRotation( transformEnd );
	
	scaleStart = Rotation2DHelpers.extractScale( transformStart, 0 );
	scaleEnd   = Rotation2DHelpers.extractScale( transformEnd, 0 );
	scaleDiff = scaleEnd - scaleStart;
	
	totalAngle = Rotation2DHelpers.shorterAngleBetweenRotations( startAngle, endAngle );
	
	cosInvAngleStart = Math.cos( -startAngle );
	sinInvAngleStart = Math.sin( -startAngle );
	
	cosInvAngleEnd = Math.cos( -endAngle );
	sinInvAngleEnd = Math.sin( -endAngle );
	
	final double[] tStart = new double[ 3 ];
	final double[] tEnd = new double[ 3 ];
	for ( int d = 0; d < 3; ++d )
	{
		tStart[ d ] = transformStart.get( d, 3 ) / scaleStart;
		tEnd[ d ] = transformEnd.get( d, 3 ) / scaleEnd;
	}
	
	xg0Start = new double[3];
	final double[] xg0End = new double[3];
	xg0Diff = new double[3];
	
	// inverse rotate scaled starting 
	Rotation2DHelpers.cosSinMult( tStart, xg0Start, cosInvAngleStart, sinInvAngleStart );
	LinAlgHelpers.scale( xg0Start, -1, xg0Start );
		
	Rotation2DHelpers.cosSinMult( tEnd, xg0End, cosInvAngleEnd, sinInvAngleEnd );
	LinAlgHelpers.scale( xg0End, -1, xg0End );
	
	LinAlgHelpers.subtract( xg0End, xg0Start, xg0Diff );
	
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:42,代码来源:SimilarityTransformAnimator2D.java


注:本文中的net.imglib2.util.LinAlgHelpers.subtract方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。