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


Java Matrix3d.setIdentity方法代码示例

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


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

示例1: getDefaultDetectorProperties

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
/**
 * Produce a Detector properties object populated with sensible default values given image shape.
 * It produces a detector normal to the beam and centred on the beam with square pixels of 0.1024mm and set 200mm
 * from the sample.
 * 
 * @param shape image shape
 */
public static DetectorProperties getDefaultDetectorProperties(int... shape) {
	int heightInPixels = shape[0];
	int widthInPixels = shape[1];
	
	// Set a few default values
	double pixelSizeX = 0.1024;
	double pixelSizeY = 0.1024;
	double distance = 200.00;
	
	// Create identity orientation
	Matrix3d identityMatrix = new Matrix3d();
	identityMatrix.setIdentity();

	// Create the detector origin vector based on the above
	Vector3d dOrigin = new Vector3d((widthInPixels - widthInPixels/2d) * pixelSizeX, (heightInPixels - heightInPixels/2d) * pixelSizeY, distance);

	return new DetectorProperties(dOrigin, heightInPixels, widthInPixels, pixelSizeX, pixelSizeY, identityMatrix);
}
 
开发者ID:eclipse,项目名称:dawnsci,代码行数:26,代码来源:DetectorProperties.java

示例2: getViewMatrix

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
	Matrix3d m = new Matrix3d();
	switch (index) {
	case 0:
		m.setIdentity(); // front vertex-centered
		break;
	case 1:
		m.rotX(-0.6523581397843639); // back face-centered -0.5535743588970415 m.rotX(Math.toRadians(-26));
		break;
	case 2:
		m.rotZ(Math.PI/2);
		Matrix3d m1 = new Matrix3d();
		m1.rotX(-1.0172219678978445);
		m.mul(m1);
		break;
	default:
		throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
	}
	return m;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:22,代码来源:Icosahedron.java

示例3: getViewMatrix

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
	Matrix3d m = new Matrix3d();
	switch (index) {
	case 0:
		m.setIdentity(); // front
		break;
	case 1:
		m.rotX(Math.PI/2); // side edge-centered
		break;
	case 2:
		m.rotY(Math.PI/n); // side face-centered
		Matrix3d m1 = new Matrix3d();
		m1.rotX(Math.PI/2);
		m.mul(m1);
		break;
	case 3:
		m.set(flipX()); // back
		break;
	default:
		throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
	}
	return m;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:25,代码来源:Prism.java

示例4: getViewMatrix

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
	Matrix3d m = new Matrix3d();
	switch (index) {
	case 0:
		m.setIdentity(); // C4 vertex-centered
		break;
	case 1:
		m.rotX(-0.5 * TETRAHEDRAL_ANGLE); // C3 face-centered  2.0*Math.PI/3
		Matrix3d m1 = new Matrix3d();
		m1.rotZ(Math.PI/4);
		m.mul(m1);
		break;
	case 2:
		m.rotY(Math.PI/4); // side face-centered
		break;
	default:
		throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
	}
	return m;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:22,代码来源:Octahedron.java

示例5: getViewMatrix

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
	Matrix3d m = new Matrix3d();
	switch (index) {
	case 0:  m.setIdentity(); // front
	break;
	case 1:  m.rotY(Math.PI/2); // left
	break;
	case 2:  m.rotY(Math.PI); // back
	break;
	case 3:  m.rotY(-Math.PI/2); // right
	break;
	case 4:  m.rotX(Math.PI/2); // top
	break;
	case 5:  m.rotX(-Math.PI/2); // bottom
	break;
	default: throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
	}
	return m;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:21,代码来源:RectangularPrism.java

示例6: Projection

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
public Projection() {
    K = new Matrix3d();
    R = new Matrix3d();
    T = new Vector3d();
    P = new Transform3D();

    K.setIdentity();
    R.setIdentity();
    T.set(0, 0, 0);
    P.setIdentity();
}
 
开发者ID:sdghrmz,项目名称:jvircam,代码行数:12,代码来源:Projection.java

示例7: getViewMatrix

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
	Matrix3d m = new Matrix3d();
	switch (index) {
	case 0:  m.setIdentity(); // front vertex-centered
	break;
	case 1:  m.rotX(Math.PI); // back face-centered
	break;
	case 2: double angle = Math.PI - 0.5 * TETRAHEDRAL_ANGLE; // Side edge-centered
	m.rotX(angle);
	break;
	default: throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
	}
	return m;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:16,代码来源:Tetrahedron.java

示例8: createSceneGraph

import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
private BranchGroup createSceneGraph() {
	BranchGroup objRoot = new BranchGroup();
	
	//Set up node for rotating the surface based on mouse drags
	TransformGroup objTransform = new TransformGroup();
	objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
	objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	
	//Set up node for translating and scaling the surface
	TransformGroup surfaceTranslate = new TransformGroup();
	TransformGroup surfaceScale = new TransformGroup();
	surfaceTranslate.setBoundsAutoCompute(true);
	surfaceScale.setBoundsAutoCompute(true);
	
	surfaceTranslate.addChild(new Surface(_organism, 32, 32));
	BoundingSphere bSphere = new BoundingSphere(surfaceTranslate.getBounds());
	Point3d center = new Point3d();
	bSphere.getCenter(center);
	double radius = bSphere.getRadius();
	
	Matrix3d rotate = new Matrix3d();
	rotate.setIdentity();
	Vector3d translate = new Vector3d(center);
	translate.negate();
	double scale = 1/radius;
	
	surfaceTranslate.setTransform(new Transform3D(rotate,translate,1.0));
	surfaceScale.setTransform(new Transform3D(rotate,new Vector3d(),scale));
	surfaceScale.addChild(surfaceTranslate);
	
	//random rotation
	Transform3D rotX = new Transform3D();
	Transform3D rotY = new Transform3D();
	Transform3D rotZ = new Transform3D();
	rotX.rotX(2*Math.PI*Math.random());
	rotY.rotY(2*Math.PI*Math.random());
	rotZ.rotZ(2*Math.PI*Math.random());
	
	rotX.mul(rotY);
	rotX.mul(rotZ);
	
	TransformGroup randRot = new TransformGroup(rotX);
	randRot.addChild(surfaceScale);
	
	//Add nodes to root tree
	objTransform.addChild(randRot);
	objRoot.addChild(objTransform);
	
	//Set up lights
	DirectionalLight dirLight = 
		new DirectionalLight(new Color3f(.9f,.9f,.9f),new Vector3f(0,0,-1));
	dirLight.setInfluencingBounds(surfaceScale.getBounds());
	objRoot.addChild(dirLight);
	
	AmbientLight ambLight = new AmbientLight(new Color3f(.3f,.3f,.3f));
	ambLight.setInfluencingBounds(surfaceScale.getBounds());
	objRoot.addChild(ambLight);
	
	//Set up mouse interactions
	MouseRotate myMouseRotate = new MouseRotate();
	myMouseRotate.setTransformGroup(objTransform);
	myMouseRotate.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseRotate);
    
	MouseZoom myMouseZoom = new MouseZoom();
	myMouseZoom.setTransformGroup(objTransform);
	myMouseZoom.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseZoom);
	
	MouseTranslate myMouseTranslate = new MouseTranslate();
	myMouseTranslate.setTransformGroup(objTransform);
	myMouseTranslate.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseTranslate);
	
    objRoot.compile();
    
	return objRoot;
}
 
开发者ID:wolfmanstout,项目名称:jene,代码行数:79,代码来源:SurfacePanel.java


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