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


Java Matrix4d.get方法代码示例

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


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

示例1: mul

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
     * Multiply this transform by t1. This transform will be update
     * and the result returned
     * 
     * @param transform
     * @return this
     */
    public CellTransform mul(CellTransform in) {
        // This does not work when scale!=1
//        this.scale *= in.scale;
//        this.translation.addLocal(rotation.mult(in.translation).multLocal(in.scale));
//        this.rotation.multLocal(in.rotation);

        // Correctly calculate the multiplication.
        Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
        Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
        Matrix4d m = new Matrix4d(q,t,scale);

        Quat4d q1 = new Quat4d(in.rotation.x, in.rotation.y, in.rotation.z, in.rotation.w);
        Vector3d t1 = new Vector3d(in.translation.x, in.translation.y, in.translation.z);
        Matrix4d m1 = new Matrix4d(q1,t1,in.scale);

        m.mul(m1);

        m.get(q);
        m.get(t);
        scale = (float)m.getScale();
        rotation.set((float)q.x, (float)q.y, (float)q.z, (float)q.w);
        translation.set((float)t.x, (float)t.y, (float)t.z);

        return this;
    }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:33,代码来源:CellTransform.java

示例2: TrackballRenderingViewer

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public TrackballRenderingViewer( CameraController.Viewer delegate )
{
	this .delegate = delegate;
	
	this .translation = new Vector3d();
	Matrix4d matrix = new Matrix4d();
	Camera defaultCamera = new Camera();
	defaultCamera .setMagnification( 1.0f );
	defaultCamera .getViewTransform( matrix, 0d );
	matrix .get( translation ); // save the default translation to apply on every update below

	// set the perspective view just once
	double near = defaultCamera .getNearClipDistance();
       double far = defaultCamera .getFarClipDistance();
       double fov = defaultCamera .getFieldOfView();
	this .delegate .setPerspective( fov, 1.0d, near, far );
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:18,代码来源:TrackballRenderingViewer.java

示例3: invert

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
     * Invert the transform, this object is inverted and returned.
     *
     * @return return this
     */
    public CellTransform invert() {
        // This invert for jme does not function when the scale != 1
//        Matrix3f rot = new Matrix3f();
//        rot.set(rotation);
//        float temp;
//        temp=rot.m01;
//        rot.m01=rot.m10;
//        rot.m10=temp;
//        temp=rot.m02;
//        rot.m02=rot.m20;
//        rot.m20=temp;
//        temp=rot.m21;
//        rot.m21=rot.m12;
//        rot.m12=temp;
//        rot.multLocal(1/scale);
//
//        rot.multLocal(translation);
//
//        translation.multLocal(-1);
//        scale = 1/scale;
//
//        rotation.fromRotationMatrix(rot);

        // Correctly compute the inversion, use Vecmath as the matrix invert
        // in JME does not function when scale!=1
        Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
        Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
        Matrix4d m = new Matrix4d(q,t,scale);
        m.invert();

        m.get(q);
        m.get(t);
        scale = (float)m.getScale();
        rotation.set((float)q.x, (float)q.y, (float)q.z, (float)q.w);
        translation.set((float)t.x, (float)t.y, (float)t.z);

        return this;
    }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:44,代码来源:CellTransform.java

示例4: trackballRolled

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
private  void trackballRolled( MouseEvent e )
  {
      // get the new coordinates
      int newX = e .getX();
      int newY = e .getY();
      // the angle in degrees is just the pixel differences
      int angleX = newX - oldX;
      int angleY = newY - oldY;
      // set the old values
      oldX = newX;
      oldY = newY;

      double radians = ((double) angleY) * mSpeed;
      AxisAngle4d yAngle = new AxisAngle4d( new Vector3d( 1d, 0d, 0d ), radians );

      radians = ((double) angleX) * mSpeed;
      AxisAngle4d xAngle = new AxisAngle4d( new Vector3d( 0d, 1d, 0d ), radians );

Matrix4d x = new Matrix4d();
      x.set( xAngle );
Matrix4d y = new Matrix4d();
      y.set( yAngle );
      x .mul( y );
      Quat4d q = new Quat4d();
      x .get( q );

      trackballRolled( q );
  }
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:29,代码来源:Trackball.java

示例5: setViewTransformation

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
@Override
public void setViewTransformation( Matrix4d trans, int eye )
{
	if ( eye == Viewer .MONOCULAR ) {
		Matrix3d justRotation3d = new Matrix3d();
		trans .get( justRotation3d );
		justRotation3d .invert(); // to match the invert() in the caller
		Matrix4d finalTransform = new Matrix4d();
		finalTransform .set( this .translation );
		finalTransform .setRotation( justRotation3d );
		finalTransform .invert(); // to match the invert() in the caller
		this .delegate .setViewTransformation( finalTransform, Viewer .MONOCULAR );
	}
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:15,代码来源:TrackballRenderingViewer.java

示例6: getRotation

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public Quat4f getRotation() {
    Matrix4d mat = this.matrixStack.peek();
    Quat4f rotation = new Quat4f();
    mat.get(rotation);
    return rotation;
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:7,代码来源:Matrix.java

示例7: getTranslationVector

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
 * Extract the translational vector of a transformation matrix.
 *
 * @param transform
 *            Matrix4d
 * @return Vector3d translation vector
 */
public static Vector3d getTranslationVector(Matrix4d transform) {
	Vector3d transl = new Vector3d();
	transform.get(transl);
	return transl;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:13,代码来源:Matrices.java


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