Coupla things on the second half about video macro block fusion from the previous post. First, it’s
δx2 = h2 tan(θ)
δx2 = atan(δx2 / h2)
The latter is working out θ which is known anyway. Just a bit of careless writing down thoughts by me.
More interestingly, the picture represents forward positive movement from left to right across the page. However, the pitch angle is negative following the right hand rule which my code adheres to. Therefore, the full conversion equation is:
δx = δx1 + h2 tan(θ)
The situation on the Y / roll axis is different. If you mentally flip the diagram left / right, following the right to left represents a positive move on the Y axis. The roll angle in this case is also positive according to the right hand rule so the equation looks like this:
δy = δy1 - h2 tan(φ)
There are other places in the code which already follow this ruling.