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


Java Quat4d.set方法代码示例

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


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

示例1: serialize

import javax.vecmath.Quat4d; //导入方法依赖的package包/类
public void serialize(StringBuffer buf) {
    logger.info("");
    buf.append("\n<camera>");
    Quat4d quat = new Quat4d();
    quat.set(attitude);
    buf.append("\n<attitude>");
    buf.append(String.valueOf(quat.x));
    buf.append(' ');
    buf.append(String.valueOf(quat.y));
    buf.append(' ');
    buf.append(String.valueOf(quat.z));
    buf.append(' ');
    buf.append(String.valueOf(quat.w));
    buf.append("</attitude>");
    buf.append("\n</camera>");
}
 
开发者ID:stelian56,项目名称:geometria,代码行数:17,代码来源:GCamera.java

示例2: orientation

import javax.vecmath.Quat4d; //导入方法依赖的package包/类
/**
 * The orientation represents the rotation of the principal axes with
 * respect to the axes of the coordinate system (unit vectors [1,0,0],
 * [0,1,0] and [0,0,1]).
 * <p>
 * The orientation can be expressed as a unit quaternion.
 * 
 * @param points
 *            array of Point3d
 * @return the orientation of the point cloud as a unit quaternion
 */
public static Quat4d orientation(Point3d[] points) {

	MomentsOfInertia moi = new MomentsOfInertia();

	for (Point3d p : points)
		moi.addPoint(p, 1.0);

	// Convert rotation matrix to quaternion
	Quat4d quat = new Quat4d();
	quat.set(moi.getOrientationMatrix());

	return quat;
}
 
开发者ID:biojava,项目名称:biojava,代码行数:25,代码来源:UnitQuaternions.java

示例3: getLocalOrientation

import javax.vecmath.Quat4d; //导入方法依赖的package包/类
/**
 * Transform the orientation of the object to one in the local coordinate
 * system.
 */
private void getLocalOrientation(double[] position, AxisAngle4f axis) {
    posVec.x = position[0];
    posVec.y = position[1];
    posVec.z = position[2];

    double norm = posVec.x * posVec.x + posVec.y * posVec.y + posVec.z * posVec.z;

    if(norm != 0) {
        norm = 1 / Math.sqrt(norm);
        posVec.x *= norm;
        posVec.y *= norm;
        posVec.z *= norm;
    } else {
        posVec.x = 0.0f;
        posVec.y = 1.0f;
        posVec.z = 0.0f;
    }

    // Align Y and X axis
    double angle = YUP.angle(posVec);

    posVec.cross(YUP, posVec);

    axis.x = (float) posVec.x;
    axis.y = (float) posVec.y;
    axis.z = (float) posVec.z;
    axis.angle = (float) angle;

    angle = XUP.angle(posVec);

    posVec.cross(XUP, posVec);

    Quat4d orig = new Quat4d();
    orig.set(axis);
    Quat4d rot = new Quat4d();
    rot.set(new AxisAngle4d(posVec.x, posVec.y, posVec.z, angle));
    orig.mul(rot);
    axis.set(orig);
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:44,代码来源:OGLGeoLocation.java

示例4: getLocalOrientation

import javax.vecmath.Quat4d; //导入方法依赖的package包/类
/**
    * Get the orientation of the coordinate for the local coordinate system.
 *
 * @param position The position coordinate to determine the rotation for.
 * @param mat The matrix object to initialize with the rotation.
    */
private void getLocalOrientation(double[] position, Matrix4f mat) {
	
       tempVec3d.x = position[0];
       tempVec3d.y = position[1];
       tempVec3d.z = position[2];

       if(geoOriginCoord != null) {
           tempVec3d.x += geoOriginCoord[0];
           tempVec3d.y += geoOriginCoord[1];
           tempVec3d.z += geoOriginCoord[2];
       }

       double norm = 
		tempVec3d.x * tempVec3d.x + 
		tempVec3d.y * tempVec3d.y + 
		tempVec3d.z * tempVec3d.z;

       if(norm != 0) {
           norm = 1 / Math.sqrt(norm);
           tempVec3d.x *= norm;
           tempVec3d.y *= norm;
           tempVec3d.z *= norm;
       } else {
           tempVec3d.x = 0.0f;
           tempVec3d.y = 1.0f;
           tempVec3d.z = 0.0f;
       }

       // Align Y and X axis
       double angle = YUP.angle(tempVec3d);

       tempVec3d.cross(YUP, tempVec3d);

       tempAxis.x = (float) tempVec3d.x;
       tempAxis.y = (float) tempVec3d.y;
       tempAxis.z = (float) tempVec3d.z;
       tempAxis.angle = (float) angle;

       angle = XUP.angle(tempVec3d);

       tempVec3d.cross(XUP, tempVec3d);

       origQuat = new Quat4d();
       origQuat.set(tempAxis);
       rotQuat = new Quat4d();
       rotQuat.set(new AxisAngle4d(tempVec3d.x, tempVec3d.y, tempVec3d.z, angle));
       origQuat.mul(rotQuat);
	mat.set(origQuat);
   }
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:56,代码来源:BaseGeoTransform.java


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