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


Java Matrix4d.setIdentity方法代码示例

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


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

示例1: buildProfile

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public static Prof buildProfile( Line3d oLine, Point3d cen ) {
	
	Matrix4d to2D = new Matrix4d();
	Vector3d c2 = oLine.dir(), c3 = new Vector3d();

	c2.normalize();

	c3.cross( c2, UP );

	to2D.setIdentity();
	to2D.setRow( 0, c3.x, c3.y, c3.z, 0 );
	to2D.setRow( 1, UP.x, UP.y, UP.z, 0 );
	to2D.setRow( 2, c2.x, c2.y, c2.z, 0 );

	{
		Point3d start = new Point3d( cen.x, 0, cen.z );
		to2D.transform( start );
		to2D.m03 = -start.x;
		to2D.m13 = -start.y;
		to2D.m23 = -start.z;
		to2D.m33 = 1;
	}

	Prof monotonic = new Prof(to2D, c2);
	return monotonic;
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:27,代码来源:Prof.java

示例2: writeTo

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
@Override
public void writeTo(VirtualInstanceCollection virtualInstanceCollection, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws UnsupportedEncodingException {
    String charSet = "UTF-8";
    JsonGenerator jg = Json.createGenerator(new OutputStreamWriter(entityStream, charSet));
    jg.writeStartArray();

    Matrix4d gM = new Matrix4d();
    gM.setIdentity();

    PartLink virtualRootPartLink = getVirtualRootPartLink(virtualInstanceCollection);
    List<PartLink> path = new ArrayList<>();
    path.add(virtualRootPartLink);
    InstanceBodyWriterTools.generateInstanceStreamWithGlobalMatrix(productService, path, gM, virtualInstanceCollection, new ArrayList<>(), jg);
    jg.writeEnd();
    jg.flush();
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:17,代码来源:VirtualInstanceCollectionMessageBodyWriter.java

示例3: combineTransformation

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
static Matrix4d combineTransformation(Matrix4d matrix, Vector3d translation, Vector3d rotation) {
    Matrix4d gM = new Matrix4d(matrix);
    Matrix4d m = new Matrix4d();

    m.setIdentity();
    m.setTranslation(translation);
    gM.mul(m);

    m.setIdentity();
    m.rotZ(rotation.z);
    gM.mul(m);

    m.setIdentity();
    m.rotY(rotation.y);
    gM.mul(m);

    m.setIdentity();
    m.rotX(rotation.x);
    gM.mul(m);

    return gM;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:23,代码来源:InstanceBodyWriterTools.java

示例4: setDefaults

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
protected void setDefaults( CPUAlgebraicSurfaceRenderer asr )
    {
        asr.getCamera().loadProperties( defaults, "camera_", "" );
        Util.setOptimalCameraDistance( asr.getCamera() );

        for( int i = 0; i < AlgebraicSurfaceRenderer.MAX_LIGHTS; i++ )
        {
            asr.getLightSource( i ).setStatus(LightSource.Status.OFF);
            asr.getLightSource( i ).loadProperties( defaults, "light_", "_" + i );
        }
        asr.setBackgroundColor( BasicIO.fromColor3fString( defaults.getProperty( "background_color" ) ) );

//        identity.setIdentity();
//        asr.setTransform( BasicIO.fromMatrix4dString( defaults.getProperty( "rotation_matrix" ) ) );
        Matrix4d scaleMatrix = new Matrix4d();
        scaleMatrix.setIdentity();
        scaleMatrix.setScale( 1.0 / Double.parseDouble( defaults.getProperty( "scale_factor" ) ) );
        asr.setSurfaceTransform( scaleMatrix );
        
		asr.setAntiAliasingMode( AntiAliasingMode.ADAPTIVE_SUPERSAMPLING );
		asr.setAntiAliasingPattern( AntiAliasingPattern.RG_2x2 );        
    }
 
开发者ID:IMAGINARY,项目名称:FormulaMorph,代码行数:23,代码来源:Gallery.java

示例5: getRepeatTransform

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
 * Return the transformation that needs to be applied to a
 * repeat in order to superimpose onto repeat 0.
 *
 * @param repeat the repeat index
 * @return transformation matrix for the repeat
 */
public Matrix4d getRepeatTransform(int repeat){

	Matrix4d transform = new Matrix4d();
	transform.setIdentity();

	int[] counts = getAxisCounts(repeat);

	for(int t = counts.length-1; t>=0; t--) {
		if( counts[t] == 0 )
			continue;
		Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
		for(int i=0;i<counts[t];i++) {
			transform.mul(axis);
		}
	}
	return transform;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:25,代码来源:SymmetryAxes.java

示例6: setC1

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void setC1(int n) {
	Rotation r = new Rotation();
	List<Integer> permutation = new ArrayList<Integer>(n);
	for (int i = 0; i < n; i++) {
		permutation.add(i);
	}
	r.setPermutation(permutation);
	Matrix4d m = new Matrix4d();
	m.setIdentity();
	r.setTransformation(m);
	r.setAxisAngle(new AxisAngle4d());
	r.setFold(1);
	r.setScores(new QuatSymmetryScores());
	rotations.add(r);
	pointGroup = "C1";
}
 
开发者ID:biojava,项目名称:biojava,代码行数:17,代码来源:RotationGroup.java

示例7: getMatrixFromAlgebraic

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public static Matrix4d getMatrixFromAlgebraic(String transfAlgebraic) {
	String[] parts = transfAlgebraic.toUpperCase().split(",");
	double[] xCoef = convertAlgebraicStrToCoefficients(parts[0].trim());
	double[] yCoef = convertAlgebraicStrToCoefficients(parts[1].trim());
	double[] zCoef = convertAlgebraicStrToCoefficients(parts[2].trim());

	Matrix4d mat = new Matrix4d();
	mat.setIdentity();
	mat.setRotation(new Matrix3d(xCoef[0],xCoef[1],xCoef[2],yCoef[0],yCoef[1],yCoef[2],zCoef[0],zCoef[1],zCoef[2]));
	mat.setTranslation(new Vector3d(xCoef[3],yCoef[3],zCoef[3]));
	return mat;
	//return new Matrix4d(xCoef[0],xCoef[1],xCoef[2],xCoef[3],
	//					yCoef[0],yCoef[1],yCoef[2],yCoef[3],
	//					zCoef[0],zCoef[1],zCoef[2],zCoef[3],
	//					0,0,0,1);
}
 
开发者ID:biojava,项目名称:biojava,代码行数:17,代码来源:SpaceGroup.java

示例8: testVecmathTransformation

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
@Test
public void testVecmathTransformation() {

	Atom atom = getAtom(1.0, 1.0, 1.0);

	//Identity transform
	Matrix4d ident = new Matrix4d();
	ident.setIdentity();
	Calc.transform(atom, ident);

	Point3d expected = new Point3d(1.0, 1.0, 1.0);
	Point3d actual = atom.getCoordsAsPoint3d();

	assertEquals(expected, actual);

	//Sample transform
	Matrix4d sample = getSampleTransform();
	Calc.transform(atom, sample);

	expected = new Point3d(2.0, 7.0, -1.3);
	actual = atom.getCoordsAsPoint3d();

	assertEquals(expected, actual);
}
 
开发者ID:biojava,项目名称:biojava,代码行数:25,代码来源:TestCalc.java

示例9: Prof

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public Prof() {
	
	Matrix4d i = new Matrix4d();
	i.setIdentity();
	
	this.toFlat = this.to3d = i;
	this.dir = new Vector3d(1,0,0);
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:9,代码来源:Prof.java

示例10: writeTo

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
@Override
public void writeTo(InstanceCollection instanceCollection, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws UnsupportedEncodingException {
    String charSet = "UTF-8";
    JsonGenerator jg = Json.createGenerator(new OutputStreamWriter(entityStream, charSet));
    jg.writeStartArray();

    Matrix4d gM = new Matrix4d();
    gM.setIdentity();
    InstanceBodyWriterTools.generateInstanceStreamWithGlobalMatrix(productService, null, gM, instanceCollection, new ArrayList<>(), jg);
    jg.writeEnd();
    jg.flush();
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:13,代码来源:InstanceCollectionMessageBodyWriter.java

示例11: Matrix

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public Matrix(int poolSize) {
    Preconditions.checkArgument(poolSize >= 0, "poolSize must be greater or equal to zero");
    this.matrixPool = new Pool<>(Matrix4d::new, poolSize);
    this.vectorPool = new Pool<>(Vector3d::new, poolSize);
    this.axisAnglePool = new Pool<>(AxisAngle4d::new, poolSize);
    this.matrixStack = new Stack<>();
    Matrix4d mat = new Matrix4d();
    mat.setIdentity();
    this.matrixStack.push(mat);
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:11,代码来源:Matrix.java

示例12: translate

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void translate(double x, double y, double z) {
    Matrix4d mat = this.matrixStack.peek();
    Matrix4d translation = this.getMatrix();
    translation.setIdentity();
    Vector3d vector = this.getVector(x, y, z);
    translation.setTranslation(vector);
    this.freeVector(vector);
    mat.mul(translation);
    this.freeMatrix(translation);
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:11,代码来源:Matrix.java

示例13: rotate

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void rotate(double angle, double x, double y, double z) {
    Matrix4d mat = this.matrixStack.peek();
    Matrix4d rotation = this.getMatrix();
    rotation.setIdentity();
    AxisAngle4d axisAngle = this.getAxisAngle(x, y, z, angle);
    rotation.setRotation(axisAngle);
    this.freeAxisAngle(axisAngle);
    mat.mul(rotation);
    this.freeMatrix(rotation);
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:11,代码来源:Matrix.java

示例14: loadJSurfFromProperties

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public static void loadJSurfFromProperties( AlgebraicSurfaceRenderer asr, Properties props )
        throws Exception
{
    asr.setSurfaceFamily( props.getProperty( "surface_equation" ) );

    Set< Map.Entry< Object, Object > > entries = props.entrySet();
    String parameter_prefix = "surface_parameter_";
    for( Map.Entry< Object, Object > entry : entries )
    {
        String name = (String) entry.getKey();
        if( name.startsWith( parameter_prefix ) )
        {
            String parameterName = name.substring( parameter_prefix.length() );
            asr.setParameterValue( parameterName, Float.parseFloat( ( String ) entry.getValue() ) );
            //System.out.println("LoadRenderPar: " + parameterName + "=" + entry.getValue() + " (" + Float.parseFloat( (String) entry.getValue()) + ") "+ asr.getParameterValue( parameterName));
        }
    }

    asr.getCamera().loadProperties( props, "camera_", "" );
    asr.getFrontMaterial().loadProperties(props, "front_material_", "");
    asr.getBackMaterial().loadProperties(props, "back_material_", "");
    for( int i = 0; i < AlgebraicSurfaceRenderer.MAX_LIGHTS; i++ )
    {
        asr.getLightSource( i ).setStatus(LightSource.Status.OFF);
        asr.getLightSource( i ).loadProperties( props, "light_", "_" + i );
    }
    asr.setBackgroundColor( BasicIO.fromColor3fString( props.getProperty( "background_color" ) ) );

    Matrix4d identity = new Matrix4d();
    identity.setIdentity();
    asr.setTransform( BasicIO.fromMatrix4dString( props.getProperty( "rotation_matrix" ) ) );
    Matrix4d scaleMatrix = new Matrix4d();
    scaleMatrix.setIdentity();
    scaleMatrix.setScale( 1.0 / Double.parseDouble( props.getProperty( "scale_factor" ) ) );
    asr.setSurfaceTransform( scaleMatrix );
}
 
开发者ID:IMAGINARY,项目名称:FormulaMorph,代码行数:37,代码来源:Util.java

示例15: calcTransformation

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
 * Superposition coords2 onto coords1 -- in other words, coords2 is rotated,
 * coords1 is held fixed
 */
private void calcTransformation() {
	
	// transformation.set(rotmat,new Vector3d(0,0,0), 1);
	transformation.set(rotmat);
	// long t2 = System.nanoTime();
	// System.out.println("create transformation: " + (t2-t1));
	// System.out.println("m3d -> m4d");
	// System.out.println(transformation);

	// combine with x -> origin translation
	Matrix4d trans = new Matrix4d();
	trans.setIdentity();
	trans.setTranslation(new Vector3d(xtrans));
	transformation.mul(transformation, trans);
	// System.out.println("setting xtrans");
	// System.out.println(transformation);
	
	// combine with origin -> y translation
	ytrans.negate();
	Matrix4d transInverse = new Matrix4d();
	transInverse.setIdentity();
	transInverse.setTranslation(new Vector3d(ytrans));
	transformation.mul(transInverse, transformation);
	// System.out.println("setting ytrans");
	// System.out.println(transformation);
}
 
开发者ID:biojava,项目名称:biojava,代码行数:31,代码来源:SuperPositionQCP.java


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