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


Java Transform3D.setRotation方法代码示例

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


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

示例1: setHeading

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Setzt Heading
 * @param headingInWorldCoord	Heading in Welt-Koordinaten
 */	
public final synchronized void setHeading(Vector3d headingInWorldCoord) {
	// Optimierung (Transform-Kram ist teuer)
	if (this.headingInWorldCoord.equals(headingInWorldCoord)) {
		return;
	}

	/*
	 * Sinn der Methode: Transform3D aktualisieren, das von Bot- nach
	 * Weltkoordinaten transformiert. (Dieses steckt in unserer
	 * TransformGroup.)
	 */
	this.headingInWorldCoord = headingInWorldCoord;

	// Winkel zwischen Welt pos. y-Achse und Bot pos. y-Achse
	double angleInRad = radiansToYAxis(headingInWorldCoord);

	Transform3D t = new Transform3D();
	transformgrp.getTransform(t);
	t.setRotation(new AxisAngle4d(0, 0, 1, angleInRad));
	transformgrp.setTransform(t);
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:26,代码来源:ThreeDBot.java

示例2: getRotationTransformation

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Returns a transformation matching the given rotation.
 */
Transform3D getRotationTransformation(float[][] modelRotation)
{
	Matrix3f modelRotationMatrix = new Matrix3f(modelRotation[0][0], modelRotation[0][1], modelRotation[0][2],
			modelRotation[1][0], modelRotation[1][1], modelRotation[1][2], modelRotation[2][0], modelRotation[2][1],
			modelRotation[2][2]);
	Transform3D modelTransform = new Transform3D();
	modelTransform.setRotation(modelRotationMatrix);
	return modelTransform;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:13,代码来源:ModelManager.java

示例3: setModelRotation

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Updates the rotation of the 3D model displayed by this component. 
 * The model is shown at its default size.
 */
protected void setModelRotation(float[][] modelRotation)
{
	BranchGroup modelNode = getModelNode();
	if (modelNode != null && modelNode.numChildren() > 0)
	{
		// Check rotation isn't set on model node 
		if (this.internalRotationAndSize)
		{
			throw new IllegalStateException("Can't set rotation");
		}
		// Apply model rotation
		Transform3D rotationTransform = new Transform3D();
		if (modelRotation != null)
		{
			Matrix3f modelRotationMatrix = new Matrix3f(modelRotation[0][0], modelRotation[0][1],
					modelRotation[0][2], modelRotation[1][0], modelRotation[1][1], modelRotation[1][2],
					modelRotation[2][0], modelRotation[2][1], modelRotation[2][2]);
			rotationTransform.setRotation(modelRotationMatrix);
		}
		// Scale model to make it fit in a 1.8 unit wide box      
		Transform3D modelTransform = new Transform3D();
		Vector3f size = ModelManager.getInstance().getSize(modelNode);
		modelTransform.setScale(1.8 / Math.max(Math.max(size.x, size.z), size.y));
		modelTransform.mul(rotationTransform);
		
		TransformGroup modelTransformGroup = (TransformGroup) this.sceneTree.getChild(0);
		modelTransformGroup.setTransform(modelTransform);
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:34,代码来源:ModelPreviewComponent.java

示例4: getModelRotationTransform

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Returns the transformation matching current model rotation.
 */
private Transform3D getModelRotationTransform()
{
	float[][] modelRotation = this.controller.getModelRotation();
	Matrix3f modelRotationMatrix = new Matrix3f(modelRotation[0][0], modelRotation[0][1], modelRotation[0][2],
			modelRotation[1][0], modelRotation[1][1], modelRotation[1][2], modelRotation[2][0], modelRotation[2][1],
			modelRotation[2][2]);
	Transform3D transform = new Transform3D();
	transform.setRotation(modelRotationMatrix);
	return transform;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:14,代码来源:ImportedFurnitureWizardStepsPanel.java

示例5: setViewPosition

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public void setViewPosition(Vector3f mov, int angle) {
    TransformGroup tg = this.simpleUniverse.getViewingPlatform().
            getViewPlatformTransform();
    Transform3D t3dTrans = new Transform3D();
    tg.getTransform(t3dTrans);
    t3dTrans.setTranslation(mov);
    tg.setTransform(t3dTrans);

    Transform3D t3dRot = new Transform3D();
    tg.getTransform(t3dRot);
    t3dRot.setRotation(
            new AxisAngle4f(1f, 0f, 0f, (float) Math.toRadians(angle)));
    //ViewT3D.setRotation(new AxisAngle4f(0, 0, 1, (float) Math.toRadians(45)));
    tg.setTransform(t3dRot);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:16,代码来源:VRLDensityVisualization.java

示例6: rotateNode

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public TransformGroup rotateNode(Node n) {
    Transform3D transRot = new Transform3D();
    TransformGroup tg = new TransformGroup();
    tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    tg.setCapability(TransformGroup.ENABLE_PICK_REPORTING);

    Vector3f cross2 = new Vector3f(1.0f, 0.0f, 0.0f);
    transRot.setRotation(new AxisAngle4f(cross2, (float) Math.toRadians(90)));
    tg.setTransform(transRot);
    return tg;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:13,代码来源:VRLDensityVisualization.java

示例7: setViewPosition

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public void setViewPosition(Vector3f mov, int angle) {
    TransformGroup tg = this.simpleUniverse.getViewingPlatform().getViewPlatformTransform();
    Transform3D t3dTrans = new Transform3D();
    tg.getTransform(t3dTrans);
    t3dTrans.setTranslation(mov);
    tg.setTransform(t3dTrans);

    Transform3D t3dRot = new Transform3D();
    tg.getTransform(t3dRot);
    t3dRot.setRotation(new AxisAngle4f(1f, 0f, 0f, (float) Math.toRadians(angle)));
    //ViewT3D.setRotation(new AxisAngle4f(0, 0, 1, (float) Math.toRadians(45)));
    tg.setTransform(t3dRot);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:14,代码来源:NeuGenDensityVisualization.java

示例8: setViewPosition

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public void setViewPosition(Vector3f mov, int angle) {
    TransformGroup tg = this.simpleU.getViewingPlatform().getViewPlatformTransform();

    Transform3D t3dTrans = new Transform3D();
    tg.getTransform(t3dTrans);
    t3dTrans.setTranslation(mov);
    tg.setTransform(t3dTrans);

    Transform3D t3dRot = new Transform3D();
    tg.getTransform(t3dRot);
    //t3dRot.setTranslation(mov);
    t3dRot.setRotation(new AxisAngle4f(1f, 0f, 0f, (float) Math.toRadians(angle)));
    //ViewT3D.setRotation(new AxisAngle4f(0, 0, 1, (float) Math.toRadians(45)));
    tg.setTransform(t3dRot);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:16,代码来源:NeuGenVisualization.java

示例9: moveBack

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private TransformGroup moveBack(Vector3f back, double scale) {
    Transform3D transform3D = new Transform3D();
    //transform3D.setTranslation(new Vector3f(0.0f, 0.0f, 0.0f));
    //transform3D.setTranslation(new Vector3f(0f, -20f, 0f));
    transform3D.setRotation(new AxisAngle4f(1.0f, 0.0f, 0.0f, (float) Math.toRadians(270)));
    //new Vector3f(-0.3f, -0.8f, -3.0f)
    transform3D.setTranslation(back);
    transform3D.setScale(scale);
    return new TransformGroup(transform3D);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:11,代码来源:NeuGenVisualization.java

示例10: showDebugBox

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Zeichnet eine Box zu Debug-Zwecken, indem sie zu TestBG hinzugefuegt wird
 * @param x Groesse in X-Richtung
 * @param y Groesse in Y-Richtung
 * @param z Groesse in Z-Richtung
 * @param transform Transformation, die auf die Box angewendet werden soll
 * @param angle Winkel, um den die Box gedreht werden soll
 */
public void showDebugBox(final double x, final double y, final double z, Transform3D transform, double angle) {
	final Box box = new Box((float) x, (float) y, (float) z, null);
	transform.setRotation(new AxisAngle4d(0, 0, 1, angle));
	TransformGroup tg = new TransformGroup();
	tg.setTransform(transform);
	tg.addChild(box);
	BranchGroup bg = new BranchGroup();
	bg.setCapability(BranchGroup.ALLOW_DETACH);
	bg.addChild(tg);
	testBG.addChild(bg);
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:20,代码来源:ThreeDBot.java

示例11: Projection

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public Projection(Matrix3d K, Matrix3d R, Vector3d T) {
    this.K = K;
    this.R = R;
    this.T = T;
    Matrix3d KR = new Matrix3d(K);
    KR.mul(R);
    Vector3d KT = new Vector3d(T);
    K.transform(KT);

    P = new Transform3D();
    P.setIdentity();
    P.setRotation(KR);
    P.setTranslation(KT);
}
 
开发者ID:sdghrmz,项目名称:jvircam,代码行数:15,代码来源:Projection.java

示例12: moveBack

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private TransformGroup moveBack() {
    Transform3D transform3D = new Transform3D();
    transform3D.setRotation(new AxisAngle4f(1f, 0f, 0f, (float) Math.toRadians(270)));
    return new TransformGroup(transform3D);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:6,代码来源:VRLDensityVisualization.java

示例13: getTransform

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Fuehrt eine Transformation durch 
 * @param pos Position 
 * @param head Blickrichtung
 * @return Die Transformation
 */
public static Transform3D getTransform(Point3d pos, Vector3d head) {
	
	Transform3D transform = new Transform3D();
	
	transform.setTranslation(new Vector3d(pos));
	
	double angle = getRotation(head);
	
	transform.setRotation(new AxisAngle4d(0d, 0d, 1d, angle));
	
	return transform;
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:19,代码来源:SimUtils.java


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