On 09/08/2013 at 11:11, xxxxxxxx wrote:
Cinema 4D Version: R13-R14
Platform: Windows ;
Language(s) : C++ ;
Here I am again with my need for rotation algorithms.
Here is the task:
I need to find the relative rotation between pink cube and aqua cube.
This rotation will be the same when the gray disc moves in space, but will change as the aqua cube's parent sphere roll on the disc.
The challenge is to find the relative rotation between the two cubes.
I want to do it using the two cubes' global position / rotation only. And not involve the sphere and/or the disc in the calculation. If the latter is impossible, then I would still be interested..
I am almost sure such calculations take place inside C4D, and that a C4D programmer would tackle this task in a minute.. or at least I assume so.
I think I once saw an algorithm on how to do this, multiplication of matrices, inverting matrices, or something in that direction.
Any help will be very much appreciated, I am stuck on this task.
BTW, if you wonder why I need this, it is for a totally different task, but I found that the image above gives a good illustration on what I am after.
Here is a Python script that might be interesting (?)
def _GlobalToLocal(self, obj, global_pos) : #""" Returns a point in global coordinate in local space. """ obj_mg = obj.GetMg() return ~obj_mg * global_pos
I do not know exactly what it does, and to what extent it can be used in C++ and in my case.