feat(R1-P3): verbatim apply_physics + Frame rotate/grotate
- CSequence.ApplyPhysics (0x00524ab0): copysign semantics — magnitude from the quantum arg, sign from the sign-source arg (call sites pass 1/framerate + signed elapsed); origin += velocity*signed, then rotate(omega*signed). - FrameOps.GRotate (0x005357a0): axis-angle quaternion (angle=|v|, half-angle sin/cos) PREMULTIPLIED onto the orientation — incremental rotation in WORLD space; |v|^2 < F_EPSILON^2 skipped. - FrameOps.Rotate (0x004525b0): local rotation vector mapped through the frame's local->global rotation, then GRotate. 7 numeric conformance tests (copysign matrix, global-space composition, local->global mapping equivalence, epsilon gate). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
778744bf3e
commit
5138b8fb01
3 changed files with 220 additions and 0 deletions
|
|
@ -253,6 +253,26 @@ public sealed class CSequence
|
|||
/// <summary><c>get_curr_frame_number</c> (0x005249d0).</summary>
|
||||
public int GetCurrFrameNumber() => (int)Math.Floor(FrameNumber);
|
||||
|
||||
// ── apply_physics (0x00524ab0, §19) ─────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Accumulated-physics root motion: advance <paramref name="frame"/> by
|
||||
/// <see cref="Velocity"/>/<see cref="Omega"/> over a signed quantum —
|
||||
/// MAGNITUDE from <paramref name="quantum"/>, SIGN from
|
||||
/// <paramref name="signSource"/> (retail copysign semantics; call sites
|
||||
/// pass 1/framerate as magnitude and the signed elapsed time as sign).
|
||||
/// </summary>
|
||||
public void ApplyPhysics(Frame frame, double quantum, double signSource)
|
||||
{
|
||||
double signed = Math.Abs(quantum);
|
||||
if (signSource < 0.0)
|
||||
signed = -signed;
|
||||
|
||||
float sq = (float)signed;
|
||||
frame.Origin += Velocity * sq;
|
||||
FrameOps.Rotate(frame, Omega * sq);
|
||||
}
|
||||
|
||||
// ── internal cursors for P4 (update_internal operates on nodes) ─────
|
||||
|
||||
internal LinkedListNode<AnimSequenceNode>? CurrAnimNode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue