Opencv visual odometry example

I actually want to ask the way computing the trajectory of visual odometry. I have been searching for an official example of visual odometry but didn’t get it. Finally, I found in an independent repository at Git (OpenCV-RgbdOdometry/main.cpp at master · tzutalin/OpenCV-RgbdOdometry · GitHub) that the trajectory is computed and updated respectively via
t_{old}= t_{new},
R_{old} = R_{new}
t_{old} = R_{old} * t_{new} + t_{old},
R_{old} = R_{old} * R_{new}.
I don’t understand this well and have a question that why not compute it this way.
Suppose the initial pose is R_{old} = 0_{3 \times 3} and t_{old} = [0, 0, 0]^T. Then the trajectory is updated via
t_{old} = R_{new}*t_{old} + t_{new},
R_{old} = R_{new}.
BTW, please share the url if there is an official example.

from docs :

Method to compute a transformation from the source frame to the destination one.

so, this is a incremental transformation matrix,
and updating the transformation state matrix by multiplying is correct.

to reassure you, the sample does the same: