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


Java Matrix4d.getElement方法代码示例

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


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

示例1: updateMatrix

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
 * Replaces low values in matrix by zeroes.
 * 
 * @param m4d
 *            Input 4x4 matrix
 * @return Filtered matrix.
 */
private static Matrix4d updateMatrix(Matrix4d m4d) {
	double tmp;

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			tmp = m4d.getElement(i, j);
			if (Math.abs(tmp) < 0.01) {
				m4d.setElement(i, j, 0D);
			}
		}
	}
	return m4d;
}
 
开发者ID:xtremexp,项目名称:UT4Converter,代码行数:21,代码来源:Geometry.java

示例2: printXMLmatrix4d

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public synchronized static void printXMLmatrix4d(PrettyXMLWriter xml,
		Matrix4d transform) throws IOException {

	if (transform == null) return;
	xml.openTag("Matrix4d");

	for (int x=0;x<4;x++){
		for (int y=0;y<4;y++){
			String key = "mat"+(x+1)+(y+1);
			String value = transform.getElement(x,y)+"";
			xml.attribute(key,value);
		}
	}
	xml.closeTag("Matrix4d");
}
 
开发者ID:biojava,项目名称:biojava,代码行数:16,代码来源:MultipleAlignmentXMLConverter.java

示例3: convertToDoubleArray

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
 * Convert a four-d matrix to a double array. Row-packed.
 * @param transformationMatrix the input matrix4d object
 * @return the double array (16 long).
 */
public static double[] convertToDoubleArray(Matrix4d transformationMatrix) {
	// Initialise the output array
	double[] outArray = new double[16];
	// Iterate over the matrix
	for(int i=0; i<4; i++){
		for(int j=0; j<4; j++){
			// Now set this element
			outArray[i*4+j] = transformationMatrix.getElement(i,j);
		}
	}
	return outArray;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:18,代码来源:MmtfUtils.java

示例4: calculateTp

import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
 * This method calculates pairing and step parameters from 4x4 transformation matrices (used internally)
 * that comes out as a Matrix4d.
 * @param input the 4x4 matrix representing the transformation from strand II -> strand I or pair i to pair i+1
 * @return Six parameters as double[6]
 */
public static double[] calculateTp(Matrix4d input) {

    double[][] A = new double[4][4];
    for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) {
        A[i][j] = input.getElement(i, j);
    }
    double[] M = new double[6];

    double cosgamma, gamma, phi, omega, sgcp, omega2_minus_phi,
            sm, cm, sp, cp, sg, cg;

    cosgamma = A[2][2];
    if (cosgamma > 1.0) cosgamma = 1.0;
    else if (cosgamma < -1.0) cosgamma = -1.0;

    gamma = acos(cosgamma);

    sgcp = A[1][1]*A[0][2]-A[0][1]*A[1][2];

    if (gamma == 0.0) omega = -atan2(A[0][1],A[1][1]);
    else omega = atan2(A[2][1]*A[0][2]+sgcp*A[1][2],sgcp*A[0][2]-A[2][1]*A[1][2]);

    omega2_minus_phi = atan2(A[1][2],A[0][2]);

    phi = omega/2.0 - omega2_minus_phi;

    M[0] = gamma*sin(phi)*180.0/PI;
    M[1] = gamma*cos(phi)*180.0/PI;
    M[2] = omega*180.0/PI;

    sm = sin(omega/2.0-phi);
    cm = cos(omega/2.0-phi);
    sp = sin(phi);
    cp = cos(phi);
    sg = sin(gamma/2.0);
    cg = cos(gamma/2.0);

    M[3] = (cm*cg*cp-sm*sp)*A[0][3]+(sm*cg*cp+cm*sp)*A[1][3]-sg*cp*A[2][3];
    M[4] = (-cm*cg*sp-sm*cp)*A[0][3]+(-sm*cg*sp+cm*cp)*A[1][3]+sg*sp*A[2][3];
    M[5] = (cm*sg)*A[0][3]+(sm*sg)*A[1][3]+cg*A[2][3];

    return M;

}
 
开发者ID:biojava,项目名称:biojava,代码行数:51,代码来源:BasePairParameters.java


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