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


Java Transform3D.invert方法代码示例

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


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

示例1: zoomOn

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Permet de déplacer de manière à centrer sur le point P(x y z )
 * @param x
 * @param y
 * @param z
 * @param direction
 *        Il s'agit de la direction dans laquelle est regardée le
 *        point. La caméra se trouvera à la translation vecteur appliqué à P
 *        La norme du vecteur indique la distance entre la caméra et le
 *        point
 */
public void zoomOn(double x, double y, double z, Vecteur direction) {
  Transform3D viewTrans = new Transform3D();
  if (direction == null) {
    return;
  }
  if (direction.norme() == 0) {
    return;
  }
  // point the view at the center of the object
  Point3d center = new Point3d(x + this.translate.x, y + this.translate.y, z + this.translate.z);
  Point3d eyePos = new Point3d(x + this.translate.x + direction.getX(), y + this.translate.y
      + direction.getY(), z + this.translate.z + direction.getZ());
  viewTrans.setIdentity();
  viewTrans.lookAt(eyePos, center, new Vector3d(0, 0, 1));
  // set the view transform
  viewTrans.invert();
  InterfaceMap3D.tgvu.setTransform(viewTrans);
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:30,代码来源:InterfaceMap3D.java

示例2: initUserPosition

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * ���[�U�̎��_��������
 */
private void initUserPosition() {
    ViewingPlatform vp = universe.getViewingPlatform(); // SimpleUniverse�̃f�t�H���g���擾
    TransformGroup steerTG = vp.getViewPlatformTransform(); // vp��TG���擾

    Transform3D t3d = new Transform3D(); // ���_�ivp�j�ړ��p��T3D
    steerTG.getTransform(t3d); // ���݂̎��_���擾

    // �V�������_��ݒ�
    // ���[�U�̈ʒu�A������̍��W�A�������w��
    // ���_�̐�͌��_
    t3d.lookAt(USER_POS, new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
    t3d.invert();

    steerTG.setTransform(t3d); // �ύX�������_��ݒ�
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:19,代码来源:MainPanel.java

示例3: initUserPosition

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private void initUserPosition()
// Set the user's initial viewpoint using lookAt()
{
	ViewingPlatform vp = su.getViewingPlatform();
	TransformGroup steerTG = vp.getViewPlatformTransform();

	Transform3D t3d = new Transform3D();
	steerTG.getTransform(t3d);

	// args are: viewer posn, where looking, up direction
	t3d.lookAt(USERPOSN, new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
	t3d.invert();

	steerTG.setTransform(t3d);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:16,代码来源:Points3DPanel.java

示例4: initUserPosition

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private void initUserPosition()
// Set the user's initial viewpoint using lookAt()
{
  ViewingPlatform vp = su.getViewingPlatform();
  TransformGroup steerTG = vp.getViewPlatformTransform();

  Transform3D t3d = new Transform3D();
  steerTG.getTransform(t3d);

  // args are: viewer posn, where looking, up direction
  t3d.lookAt(USERPOSN, new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
  t3d.invert();

  steerTG.setTransform(t3d);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:16,代码来源:Points3DPanel.java

示例5: initViewpoint

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Permet d'initialiser un point de vue (1) Vue depuis l'axe des XMax de la
 * scene (2) Vue depuis l'axe des XMin de la scene (3) Vue depuis l'axe des
 * YMax de la scene (4) Vue depuis l'axe des YMin de la scene (5) Vue depuis
 * l'axe des ZMax de la scene (6) Vue depuis l'axe des ZMin de la scene
 * @param axis
 *        Un entier correspondant à l'axe
 * @return la distance entre la caméra et l'objet
 */
public double initViewpoint(int axis) {
  Transform3D viewTrans = new Transform3D();
  BoundingSphere sceneBounds = new BoundingSphere(this.Bgeneral.getBounds());
  // point the view at the center of the object
  Point3d center = new Point3d();
  sceneBounds.getCenter(center);
  double radius = sceneBounds.getRadius();
  // On effectue cette Opération afin d'avoir toujours quelque chose à
  // l'écran
  radius = Math.min(radius, ConstantRepresentation.backClip * 2);
  Point3d eyePos = new Point3d(center);
  Vector3d up = new Vector3d();
  // pull the eye back far enough to see the whole object
  double eyeDist = radius;
  switch (axis) {
    case 1:
      eyePos.x += eyeDist;
      up.z = 1;
      break;
    case 2:
      eyePos.x -= eyeDist;
      up.z = 1;
      break;
    case 3:
      eyePos.y += eyeDist;
      up.z = 1;
      break;
    case 4:
      eyePos.y -= eyeDist;
      up.z = 1;
      break;
    case 5:
      eyePos.z += eyeDist;
      up.y = 1;
      break;
    case 6:
      eyePos.z -= eyeDist;
      up.y = 1;
      break;
  }
  viewTrans.setIdentity();
  viewTrans.lookAt(eyePos, center, up);
  viewTrans.invert();
  // set the view transform
  InterfaceMap3D.tgvu.setTransform(viewTrans);
  return eyeDist;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:57,代码来源:InterfaceMap3D.java

示例6: changeViewPoint

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Change the user view Point . Note that we modify the ViewBranch transform
 * not the scene transform.
 * 
 * @param type
 *            can be VIEW_FROM_TOP,VIEW_FROM_EAST,VIEW_BEHIND_AGENT
 * @param agent
 *            : specify the agent if VIEW_BEHIND_AGENT
 * 
 *            The VIEW_BEHIND_AGENT case has to be called regularly because
 *            of the agent displacement.
 */

public void changeViewPoint(int type, SimpleAgent agent) {
	Point3d p1 = new Point3d();
	Point3d p2 = new Point3d();

	Transform3D t1 = new Transform3D();
	Transform3D t2 = new Transform3D();
	t1.setIdentity();
	t2.setIdentity();
	mouseOrbiter.resetView();
	switch (type) {
	case VIEW_FROM_TOP:
		t1.lookAt(new Point3d(0, worldSize * 1.2, 0), new Point3d(0, 0, 0), new Vector3d(0, 0, -1));
		t1.invert();
		viewTransformGroup.setTransform(t1);
		break;
	case VIEW_FROM_EAST:
		t1.lookAt(new Point3d(worldSize, worldSize, 0), new Point3d(0, 0, 0), new Vector3d(-1, 0, 0));
		t1.invert();
		viewTransformGroup.setTransform(t1);
		break;
	case VIEW_BEHIND_AGENT:
		t1.setTranslation(new Vector3d(-agent.getRadius() * 2, 0, 0));
		agent.getGroup().getLocalToVworld(t2);
		t1.mul(t2);
		viewTransformGroup.setTransform(t1);
		break;
	case VIEW_ABOVE_AGENT:
		agent.getRotationTransformGroup().getLocalToVworld(t1);
		t1.transform(p1);
		t1.transform(p2);
		p2.y = worldSize * .8;
		t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
		t1.invert();
		viewTransformGroup.setTransform(t1);
		break;

	case VIEW_ABOVE_AGENT_NEAR:
		agent.getRotationTransformGroup().getLocalToVworld(t1);
		t1.transform(p1);
		t1.transform(p2);
		p2.y = agent.getHeight() * worldSize * 0.5;
		// avoid front clipping
		if (p2.y < 0.2)
			p2.y = 0.2;
		t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
		t1.invert();
		viewTransformGroup.setTransform(t1);

		break;
	case VIEW_AGENT_SIDE:

		agent.getRotationTransformGroup().getLocalToVworld(t1);
		t1.transform(p1);
		t1.transform(p2);
		agent.rotation.transform(p2);
		t2.setTranslation(new Vector3d(0, agent.getHeight() * 2, agent.getRadius() * 10));
		t2.transform(p2);
		t1.lookAt(p2, p1, new Vector3d(0, 1, 0));
		t1.invert();
		viewTransformGroup.setTransform(t1);

		break;
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:78,代码来源:World.java

示例7: getViewPosInLocal

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * return the eye's position in <node>'s coordinate space
 */
Point3d getViewPosInLocal(Node node)
{

	Point3d viewPosition = new Point3d();
	Vector3d translate = new Vector3d();
	double angle = 0.0;
	double mag, sign;
	double tx, ty, tz;

	if (node == null)
	{
		System.out.println("called getViewPosInLocal() with null node");
		return null;
	}
	if (!node.isLive())
	{
		System.out.println("called getViewPosInLocal() with non-live node");
		return null;
	}

	// get viewplatforms's location in virutal world
	Canvas3D canvas = view.getCanvas3D(0);
	canvas.getCenterEyeInImagePlate(viewPosition);
	Transform3D t = new Transform3D();
	canvas.getImagePlateToVworld(t);
	t.transform(viewPosition);
	// System.out.println("vworld view position is " + viewPosition);

	// get parent transform
	Transform3D parentInv = new Transform3D();
	node.getLocalToVworld(parentInv);
	// System.out.println("node xform is \n" + parentInv);
	parentInv.invert();

	// transform the eye position into the parent's coordinate system
	parentInv.transform(viewPosition);

	// System.out.println("node space view position is " + viewPosition);

	return viewPosition;
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:45,代码来源:Renderer.java

示例8: changeViewPoint

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
 * Change the user view Point . Note that we modify the ViewBranch transform
 * not the scene transform.
 * 
 * @param type
 *          can be VIEW_FROM_TOP,VIEW_FROM_EAST,VIEW_BEHIND_AGENT
 * @param agent
 *          : specify the agent if VIEW_BEHIND_AGENT
 * 
 *          The VIEW_BEHIND_AGENT case has to be called regularly because of
 *          the agent displacement.
 */

public void changeViewPoint(int type, SimpleAgent agent) {
  Point3d p1 = new Point3d();
  Point3d p2 = new Point3d();

  Transform3D t1 = new Transform3D();
  Transform3D t2 = new Transform3D();
  t1.setIdentity();
  t2.setIdentity();
  mouseOrbiter.resetView();
  switch (type) {
    case VIEW_FROM_TOP:
      t1.lookAt(new Point3d(0, worldSize * 1.2, 0), new Point3d(0, 0, 0), new Vector3d(0, 0, -1));
      t1.invert();
      viewTransformGroup.setTransform(t1);
      break;
    case VIEW_FROM_EAST:
      t1.lookAt(new Point3d(worldSize, worldSize, 0), new Point3d(0, 0, 0), new Vector3d(-1, 0, 0));
      t1.invert();
      viewTransformGroup.setTransform(t1);
      break;
    case VIEW_BEHIND_AGENT:
      t1.setTranslation(new Vector3d(-agent.getRadius() * 2, 0, 0));
      agent.getGroup().getLocalToVworld(t2);
      t1.mul(t2);
      viewTransformGroup.setTransform(t1);
      break;
    case VIEW_ABOVE_AGENT:
      agent.getRotationTransformGroup().getLocalToVworld(t1);
      t1.transform(p1);
      t1.transform(p2);
      p2.y = worldSize * .8;
      t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
      t1.invert();
      viewTransformGroup.setTransform(t1);
      break;

    case VIEW_ABOVE_AGENT_NEAR:
      agent.getRotationTransformGroup().getLocalToVworld(t1);
      t1.transform(p1);
      t1.transform(p2);
      p2.y = agent.getHeight() * worldSize * 0.5;
      // avoid front clipping
      if (p2.y < 0.2)
        p2.y = 0.2;
      t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
      t1.invert();
      viewTransformGroup.setTransform(t1);

      break;
    case VIEW_AGENT_SIDE:

      agent.getRotationTransformGroup().getLocalToVworld(t1);
      t1.transform(p1);
      t1.transform(p2);
      agent.rotation.transform(p2);
      t2.setTranslation(new Vector3d(0, agent.getHeight() * 2, agent.getRadius() * 10));
      t2.transform(p2);
      t1.lookAt(p2, p1, new Vector3d(0, 1, 0));
      t1.invert();
      viewTransformGroup.setTransform(t1);

      break;
  }
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:78,代码来源:World.java

示例9: ObjectLoader

import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public ObjectLoader() {

		setLayout(new BorderLayout());
		GraphicsConfiguration graphicsConfig = SimpleUniverse
				.getPreferredConfiguration();

		Canvas3D canvas3D = new Canvas3D(graphicsConfig);
		add(canvas3D);
		canvas3D.setSize(1200, 800);
		canvas3D.setVisible(true);

		BranchGroup scene = new BranchGroup();

		ObjectFile loader = new ObjectFile(ObjectFile.LOAD_ALL);
		loader.setFlags(ObjectFile.RESIZE);

		Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);

		BoundingSphere bounds =

		new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

		Vector3f light1Direction = new Vector3f(2.0f, 12.0f, -12.0f);

		DirectionalLight light1

		= new DirectionalLight(light1Color, light1Direction);

		light1.setInfluencingBounds(bounds);

		scene.addChild(light1);

		Scene modelScene = null;

		try {
			modelScene = loader.load("Images/gargoyle.obj");

		} catch (Exception e) {

		}

		scene.addChild(modelScene.getSceneGroup());

		SimpleUniverse universe = new SimpleUniverse(canvas3D);
		universe.getViewingPlatform().setNominalViewingTransform();

		universe.addBranchGraph(scene);
		
		ViewingPlatform viewPlatform = universe.getViewingPlatform();
	    TransformGroup viewTransform = viewPlatform.getViewPlatformTransform();
	    Transform3D t3d = new Transform3D();
	    viewTransform.getTransform(t3d);
	    t3d.lookAt(new Point3d(0, 0, 4), new Point3d(0, 0, 0), new Vector3d(0, 1, 0));
	    t3d.invert();
	    viewTransform.setTransform(t3d);

	}
 
开发者ID:GettingNifty,项目名称:Heavy-Evil,代码行数:58,代码来源:ObjectLoader.java


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