[vtkusers] manipulation of the scene

Dženan Zukić dzenanz at gmail.com
Wed Aug 24 14:02:52 EDT 2011


Well, as I said, I don't have experience in manipulating hierarchical scene
graph. I know how it should be done on an abstract level, but I never had to
do it. I would be stabbing in the dark just the same as you are doing it :)

2011/8/24 Kacper Pluta <kacper.pluta at gmail.com>

> Hi, I Used the vtkAssembly hierarchy and i have one new problem. When I
> turn the tree so that new root was in the upright position. It seems to me
> that the coordinates of the new roots are not current after tree rotation.
>
> Part of my code below. And screenshot as an attachment.
>
>   root = Tree->GetParts()->GetLastProp3D();
>   double *orientation = root->GetOrientation();
>   Tree->SetOrientation(0,0,-*(orientation+2)); //left root n the upright
> position
>
>
>
> LeftBranchActor->SetPosition(*(root->GetXRange()+1)+LeftBranch->GetRadius(),*(root->GetYRange())-LeftBranch->GetHeight()/2,0);
>
>   LeftBranchActor->RotateZ(angle);
>
>
> RightBranchActor->SetPosition(*(root->GetXRange())-RightBranch->GetRadius(),*(root->GetYRange())-RightBranch->GetHeight()/2,0);
>
>   RightBranchActor->RotateZ(angle);
>
>   Tree->AddPart(RightBranchActor);
>   Tree->AddPart(LeftBranchActor);
>   //Tree->SetOrientation(0,0,0);
>
>   GenTree(Tree->GetParts()->GetLastProp3D(),--rate,radius*pow(r,1/n));
>
> By the way thanks for your replies.
>
>
>
> 2011/8/24 Dženan Zukić <dzenanz at gmail.com>
>
>> GetMatrix <http://www.vtk.org/doc/release/5.0/html/a01919.html#z4208_1> or
>> GetUserMatrix I guess. Try it and/or read documentation. I never used
>> assemblies until a few days ago, and that was just for grouping.
>>
>> 2011/8/24 Kacper Pluta <kacper.pluta at gmail.com>
>>
>>> How do I get to a particular matrix of element in the vtkAssembly
>>> hierarchy?
>>>
>>>
>>> 2011/8/24 Dženan Zukić <dzenanz at gmail.com>
>>>
>>>> Why don't you use a straightforward tree hierarchy of vtkAssemblies,
>>>> each one having its own transformation matrix, nested under its parent's
>>>> transformation matrix? That way you only need to worry about a branches
>>>> transformation at its parents joint, and the hierarchy does the rest of the
>>>> job for you?
>>>>
>>>> I have not read this, but you may check this out:
>>>> http://www.maplesoft.com/applications/view.aspx?SID=6850&view=html
>>>>
>>>> Also you can try searching "scene graph hierarchy tutorial".
>>>>
>>>> 2011/8/24 Kacper Pluta <kacper.pluta at gmail.com>
>>>>
>>>>> Now I see my mistake. I am using the coordinates of the root, and this
>>>>> is yet another place than the family, which is a part. Except that this
>>>>> knowledge did not give me any more answers ...
>>>>>
>>>>>
>>>>> 2011/8/24 Kacper Pluta <kacper.pluta at gmail.com>
>>>>>
>>>>>> I know but it's not a solution. I want to build 3d tree of cylinders,
>>>>>> and I have a problem with inserting new branches at a right angle. It
>>>>>> is very easy when the root is in the upright position. I tried to do this
>>>>>> using vtkAssembly.The whole procedure is described in the following
>>>>>> pseudocode. I have a problem with an appropriate setting for the
>>>>>> family, after the restoration of the root to its original position.
>>>>>> I thought it would be easier to add new branches without touching the
>>>>>> root. I just manipulating the world coordinate system.
>>>>>>
>>>>>> Attached a part of the tree, which i want to get.
>>>>>>
>>>>>> NODE GenTree(NODE root, int bifurcation)
>>>>>> {
>>>>>>   if(bifurcation > 0 && root != NULL)
>>>>>>   {
>>>>>>
>>>>>>    Restart the angle of Parent root famili if exist;
>>>>>>   //(root is part of the family, e.g. the left child of his Parent)
>>>>>>
>>>>>>     Restart the root angle;
>>>>>>
>>>>>>     //Now root agnel is set to 90 degrees
>>>>>>
>>>>>>     //make new bifurcation
>>>>>>     Create the children;
>>>>>>     Set children position to lower ends of root;
>>>>>>     Set children origin to center of root;
>>>>>>     rotate the children on Z axis;
>>>>>>
>>>>>>     restore root angle;
>>>>>>     restore Parent of root famili angle;
>>>>>>
>>>>>>    //Make root famili
>>>>>>    root->Famili = vtkAssembly::New();
>>>>>>    root->Famili->AddPart(root->
>>>>>> Left->BranchActor);
>>>>>>    root->Famili->AddPart(root->Right->BranchActor);
>>>>>>
>>>>>>     Set Famili origin??
>>>>>>     rootate the root famili?
>>>>>>    //Now the family is at the end of the root.
>>>>>>
>>>>>>     root->Left->Left = GenTree(root->Left,--bifurcation);
>>>>>>    //root->Left->Right = GenTree(root->Right,--bifurcation);
>>>>>>   }
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2011/8/24 Dženan Zukić <dzenanz at gmail.com>
>>>>>>
>>>>>>> If you don't want to manipulate the camera, you can put the whole
>>>>>>> scene into an vtkAssembly and then apply transformation to it.
>>>>>>>
>>>>>>> On Tue, Aug 23, 2011 at 20:03, Kacper Pluta <kacper.pluta at gmail.com>wrote:
>>>>>>>
>>>>>>>>  Hi!
>>>>>>>>
>>>>>>>> How do I rotate the whole scene? But I do not mean the camera.
>>>>>>>>
>>>>>>>> --
>>>>>>>> "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
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Powered by www.kitware.com
>>>>>>>>
>>>>>>>> Visit other Kitware open-source projects at
>>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>>
>>>>>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>>>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>>>
>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> "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
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> "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
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> "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
>>>
>>>
>>
>
>
> --
> "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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110824/3fe17f0a/attachment.htm>


More information about the vtkusers mailing list