benilla-re systems structs docs

QuaternionLog

function · cmath · unreached

Address
0x7c04f0 · 119 bytes, up to 0x7c0566
Signature
NTempest::C4Quaternion * __thiscall (NTempest::C4Quaternion *this, NTempest::C4Quaternion *out)
Meaning
Writes the quaternion logarithm as a rotation vector
Confidence
verified, proof two
Finding
cmath/quaternions#exponential-and-logarithm

Finding: Exponential and logarithm in cmath: quaternions

0x7c0450(out) maps a rotation vector v = (x, y, z) (the first three floats of this) to the quaternion (k·v, cos θ) with θ = |v| and k = sin θ/θ; when |sin θ| is below 2⁻²¹ (0x81d9a0) it writes (v, cos θ) unchanged. 0x7c04f0(out) is the logarithm: for |w| strictly below 1 it writes ((θ/sin θ)·v, 0) with θ = acos(w), and when |sin θ| is below 2⁻²¹, or |w| is 1 or more or NaN, it writes (v, 0). The multiplication in the exponential uses k unrounded for the z component and rounded for x and y.

The derivation is in the doc.

Callers 3

Callees 1

Calls and jumps by a bare address, from tables/calls.tsv.