us.ihmc.euclid.tuple4D.interfaces.QuaternionBasics.normalize()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中us.ihmc.euclid.tuple4D.interfaces.QuaternionBasics.normalize方法的一些代码示例,展示了QuaternionBasics.normalize的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QuaternionBasics.normalize方法的具体详情如下:
包路径:us.ihmc.euclid.tuple4D.interfaces.QuaternionBasics
类名称:QuaternionBasics
方法名:normalize

QuaternionBasics.normalize介绍

暂无

代码示例

代码示例来源:origin: us.ihmc/euclid-geometry

/**
* Normalizes the quaternion part of this pose to ensure it is a unit-quaternion describing a proper
* orientation.
* <p>
* Edge cases:
* <ul>
* <li>if the quaternion contains {@link Double#NaN}, this method is ineffective.
* </ul>
* </p>
*/
default void normalizeQuaternion()
{
 getOrientation().normalize();
}

代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit

public static void packJMEQuaterionInVecMathQuat4d(Quaternion original, QuaternionBasics target)
{
 target.set(original.getX(), original.getY(), original.getZ(), original.getW());
 // do not remove the normalization. 
 // The conversion from float to double generates very tiny differences which make the 
 // quaternion SLIGHTLY not normal.
 target.normalize();
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

/**
* Projects the provided {@code rotation} onto {@code axis} such that the original rotation can be decomposed
* into a rotation around {@code axis} and one around an orthogonal axis.
* <p>
* rotation = orthogonalRotation * result
* </p>
* @param rotation is the original rotation to be projected onto {@code axis}
* @param axis is the desired rotation axis of the result.
* @param result will be modified to contain the component of {@code rotation} that is around {@code axis}
*/
public static void projectRotationOnAxis(QuaternionReadOnly rotation, Vector3DReadOnly axis, QuaternionBasics result)
{
 double dotProduct = rotation.getX() * axis.getX() + rotation.getY() * axis.getY() + rotation.getZ() * axis.getZ();
 double scale = dotProduct / axis.lengthSquared();
 double projectedX = scale * axis.getX();
 double projectedY = scale * axis.getY();
 double projectedZ = scale * axis.getZ();
 result.set(projectedX, projectedY, projectedZ, rotation.getS());
 result.normalize();
}

相关文章