I am trying to write export of 3-dimensional plant modeling software in Three.js, but am stuck in turns and object translations.
So far I have tried to use quaternions and transformation matrices, but both results do not satisfy. For my tests, I use a simple binary tree that initially looks like this:

my export results:

The export code can be found in the section
http://ufgb966.forst.uni-goettingen.de/three/test2Quaternion.html
http://ufgb966.forst.uni-goettingen.de/three/test2Matrix.html
This suggests that my rotations are made around the wrong point. Each rotation should be performed around the beginning of each geometry. What will be the method to achieve the result I'm looking for?
source share