Hello all, I have been working for some time on developing some code to produce 3d trees. Whoever wants to take a look at the post, it's
here. There is a sub-problem of the tree problem which made me start this new post.
Problem description:
We have a local coordinate system, defined by a point in the world Coordinate System (the local zero point).
Then we apply some rotations to the local coordinate system.
Then we make another local coordinate system, which is dependent to the first one (the first local c.s., not the world c.s.) and we apply new rotations to it.
Then there is another local, dependent on the previous one, and so on.
I have been using openGL commands to handle the local coordinate systems, like the translate command. And I can store the world coordinates of a local point by using modelX(), modelY() and modelZ(). Then pushmatrix() takes us back to the world coordinate system. But I am having trouble in passing the local rotations the right way.
The problem could also be rephrased/approached as follows:
how to match a coordinate system's axis to a random 3d vector.
Any thoughts on the matter would be greatly appreciated.
* I did not post a code example here yet, but the latest (at the time) post of 3dtree includes this problem.
1