• Andrey Filippov's avatar
    CLAUDE: Fix getInterseqScale() to use integer corr_inc for BX/AX/BY/AY positions · b691e9f3
    Andrey Filippov authored
    getInterseqScale() was calling getCorrIncExact() which returns 0.5*corr_offset
    for half_step mode instead of the actual integer keyframe step getCorrInc()
    (= corr_offset/2 with integer division). For odd corr_offset (e.g. 5) with
    half_step=true these differ: getCorrIncExact()=2.5 vs getCorrInc()=2.
    
    This caused getHalfBeforeAfterPixXY() to compute:
      after - before = RSLT_VX * 0.5   (wrong; observed by user)
    instead of:
      after - before = RSLT_VX * corr_inc/corr_offset = RSLT_VX * 0.4  (correct)
    
    recalcOmegas() uses the same interseq_scale in the inverse direction, so it
    also reconstructed RSLT_VX/VY incorrectly from neighbouring keyframe positions.
    
    Fix: use getCorrInc() (integer) in getInterseqScale() so that BX/AX positions
    correspond to actual raw-frame midpoints and the velocity round-trip is exact.
    
    Also adds an unambiguous convention comment near RSLT_VX/RSLT_VY in
    CuasMotionLMA.java documenting all required scale conversions.
    
    The omega calculation (getFrameVelocityScale * ifov * fps_raw) is independent
    of corr_inc and was already correct.
    Co-authored-by: 's avatarClaude <claude@elphel.com>
    b691e9f3
CuasMotion.java 517 KB