mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpimath] Quaternion::Log(): Remove duplicate calls to norm() (#6358)
This commit is contained in:
@@ -285,11 +285,12 @@ public class Quaternion implements ProtobufSerializable, StructSerializable {
|
||||
* @return The logarithm of this quaternion.
|
||||
*/
|
||||
public Quaternion log() {
|
||||
var scalar = Math.log(norm());
|
||||
var norm = norm();
|
||||
var scalar = Math.log(norm);
|
||||
|
||||
var v_norm = Math.sqrt(getX() * getX() + getY() * getY() + getZ() * getZ());
|
||||
|
||||
var s_norm = getW() / norm();
|
||||
var s_norm = getW() / norm;
|
||||
|
||||
if (Math.abs(s_norm + 1) < 1e-9) {
|
||||
return new Quaternion(scalar, -Math.PI, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user