Hi @ymoon,
Thanks for reaching out to us. Glad your problem is solved!
Here are some pointers to the docs with related toolset:
c4d.Vector, c4d.Matrix, c4d.utils.
Please note, there's Matrix Manual, although math questions are generally out of scope of the support on this forum.
Cheers,
Ilia