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


Java RealPoint.getDoublePosition方法代码示例

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


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

示例1: click

import net.imglib2.RealPoint; //导入方法依赖的package包/类
@Override
public void click( final int x, final int y )
{
	final long oldActiveFragmentId = selectionController.getActiveFragmentId();
	final long id = idPicker.getIdAtDisplayCoordinate( x, y );
	assignment.mergeFragmentSegments( oldActiveFragmentId, id );
	selectionController.setActiveFragmentId( id );
	viewer.requestRepaint();

	final RealPoint pos = new RealPoint( 3 );
	viewer.displayToGlobalCoordinates( x, y, pos );
	final Merge merge = new Merge(
			lastClick.getDoublePosition( 0 ),
			lastClick.getDoublePosition( 1 ),
			lastClick.getDoublePosition( 2),
			pos.getDoublePosition( 0 ),
			pos.getDoublePosition( 1 ),
			pos.getDoublePosition( 2 ),
			oldActiveFragmentId,
			id );
	merges.add( merge );

	viewer.displayToGlobalCoordinates( x, y, lastClick );
	System.out.println( "recoreded 'need merge' of " + oldActiveFragmentId + " with " + id );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:26,代码来源:MergeController.java

示例2: rotate

import net.imglib2.RealPoint; //导入方法依赖的package包/类
/**
 * Rotates the given Polygon consisting of a list of RealPoints by the given
 * angle about the given center.
 *
 * @param inPoly A Polygon consisting of a list of RealPoint RealPoints
 * @param angle the rotation angle
 * @param center the rotation center
 * @return a rotated polygon
 */
private Polygon rotate(final Polygon inPoly, final double angle,
	final RealLocalizable center)
{

	List<RealLocalizable> out = new ArrayList<>();

	for (RealLocalizable RealPoint : inPoly.getVertices()) {

		// double angleInRadians = Math.toRadians(angleInDegrees);
		double cosTheta = Math.cos(angle);
		double sinTheta = Math.sin(angle);

		double x = cosTheta * (RealPoint.getDoublePosition(0) - center
			.getDoublePosition(0)) - sinTheta * (RealPoint.getDoublePosition(1) -
				center.getDoublePosition(1)) + center.getDoublePosition(0);

		double y = sinTheta * (RealPoint.getDoublePosition(0) - center
			.getDoublePosition(0)) + cosTheta * (RealPoint.getDoublePosition(1) -
				center.getDoublePosition(1)) + center.getDoublePosition(1);

		out.add(new RealPoint(x, y));
	}

	return new Polygon(out);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:35,代码来源:DefaultSmallestEnclosingRectangle.java

示例3: goTo

import net.imglib2.RealPoint; //导入方法依赖的package包/类
public void goTo(final RealPoint position) {

		final RealPoint currentCenter = new RealPoint(3);
		viewer.displayToGlobalCoordinates(viewer.getWidth() / 2,
				viewer.getHeight() / 2, currentCenter);

		System.out.println("current center is at " + currentCenter);

		final double dX = currentCenter.getDoublePosition(0)
				- position.getDoublePosition(0);
		final double dY = currentCenter.getDoublePosition(1)
				- position.getDoublePosition(1);
		final double dZ = currentCenter.getDoublePosition(2)
				- position.getDoublePosition(2);

		System.out.println("translating by " + dX + ", " + dY + ", " + dZ);

		final AffineTransform3D translate = new AffineTransform3D();
		translate.translate(new double[] { dX, dY, dZ });

		synchronized (viewer) {

			final AffineTransform3D viewerTransform = new AffineTransform3D();
			viewer.getState().getViewerTransform(viewerTransform);
			final AffineTransform3D translated = viewerTransform
					.concatenate(translate);
			viewer.setCurrentViewerTransform(translated);
		}

		viewer.requestRepaint();
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:32,代码来源:AnnotationsController.java


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