本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.NORM属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.NORM属性的具体用法?Java LocalizedFormats.NORM怎么用?Java LocalizedFormats.NORM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.NORM属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalize
/**
* Computes the normalized quaternion (the versor of the instance).
* The norm of the quaternion must not be zero.
*
* @return a normalized quaternion.
* @throws ZeroException if the norm of the quaternion is zero.
*/
public Quaternion normalize() {
final double norm = getNorm();
if (norm < Precision.SAFE_MIN) {
throw new ZeroException(LocalizedFormats.NORM, norm);
}
return new Quaternion(q0 / norm,
q1 / norm,
q2 / norm,
q3 / norm);
}
示例2: getInverse
/**
* Returns the inverse of this instance.
* The norm of the quaternion must not be zero.
*
* @return the inverse.
* @throws ZeroException if the norm (squared) of the quaternion is zero.
*/
public Quaternion getInverse() {
final double squareNorm = q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3;
if (squareNorm < Precision.SAFE_MIN) {
throw new ZeroException(LocalizedFormats.NORM, squareNorm);
}
return new Quaternion(q0 / squareNorm,
-q1 / squareNorm,
-q2 / squareNorm,
-q3 / squareNorm);
}