At the beginning I would like to welcome you all!<br><br>Some time ago, precisely some days ago I started to learn VTK and I encountered a problem with rotation. I wanna write a recursive function to generate a tree in 3D. I generated a part of a tree, so you could see what I mean.<br>
<br>Below is a pseudocode. So you can see from my point of view, and you may be able to correct it.<br><br>I have a big problem with the setup of new children at a right angle at the end of their root, after the restoration of the root angle, and angle of the family to which it belongs.<br>
<br><br>NODE GenTree(NODE root, int bifurcation)<br>{<br>Â if(bifurcation > 0 && root != NULL)<br>Â {Â <br>Â <br>Â Â Restart the angle of Parent root famili if exist;<br>Â //(root is part of the family, e.g. the left child of his Parent)<br>
<br>Â Â Â Restart the root angle;<br><br>Â Â Â //Now root agnel is set to 90 degrees<br>Â Â Â <br>Â Â Â //make new bifurcation<br>Â Â Â Create the children;<br>Â Â Â Set children position to lower ends of root;<br>Â Â Â Set children origin to center of root;<br>
   rotate the children on Z axis;<br>  <br>   restore root angle;<br>   restore Parent of root famili angle;<br><br>  //Make root famili<br>  root->Famili = vtkAssembly::New();<br>  root->Famili->AddPart(root->Left->BranchActor);<br>
  root->Famili->AddPart(root->Right->BranchActor);<br><br>   Set Famili origin??<br>   rootate the root famili?<br>  //<span lang="en"><span>Now the</span> <span>family</span> <span>is at the end</span> <span>of the root.</span></span><br>
<br>Â Â Â root->Left->Left = GenTree(root->Left,--bifurcation);<br>Â Â //root->Left->Right = GenTree(root->Right,--bifurcation);<br>Â }<br>}<br clear="all"><br><br>/**********************/<br>OS: OpenSUSE 11.4 x86_64<br>
VTK VERSION: 5.6.1<br>cmake: 2.8.3<br>Language: C++<br>/**********************/<br><br>-- <br>"If you build your empire on money, it'll fall like a house of cards, if you build it on love, you've built Taj Mahal!" - Mark Hartmaier<br>
<br>