is there a way to set the bounds of a vtkActor? Why don't exist vtkActor->SetBounds(double[])? Regards. _______________________________________________ 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 |
That is because, the bounds generetic represent the "size" of an object.
Setting its boundingbox thus would need to manipulate the object to match it's new bounds. That would be quite a huge task for the setBounds() function... You can always use the vtkBoundingBox class and manipulate that http://www.vtk.org/doc/nightly/html/classvtkBoundingBox.html#details but I believe that is not what you want to do... KR Adrian |
Example:
the bounds of my actor: bounds [0] to bounds [1]: 0 to 50 (X-direction) bounds [2] to bounds [3]: 0 to 30 (Y-direction) bounds [4] to bounds [5]: 0 to 40 (Z direction). bounds = {0, 50, 0, 30, 0, 40} I Rotate my vtkActor (actor->RotateY(..)). Of course, the bounds are changed now. Then we have: bounds [0] to bounds [1]: 5 to 45 (X-direction) bounds [2] to bounds [3]: 0 to 30 (Y-direction) bounds [4] to bounds [5]: -5 to 45 (Z-direction). These bounds I would like to redefine. result should then be: newBounds = {0, 40, 0, 30, 0, 50} Can I dont set the bounds, anywhere? |
Hi,
it's not perfectly clear for me what you wish to accomplish. The object got rotated around its core/center and by that generated those bounding-boxes. Your example by the way is 1:1 the same, but starting on different coordinates. Bounds are usually a distance, not a good coordinate measurement. You can either write your own code, that extracts the distance, and fills a new double[] always starting at 0 in 0/2/4 and the total value in 1/3/5. You can also move the vtkObject with setPosition and calculate the required offsets... but somehow that tastes wrong, because it alters the place in space. What exactly is the behavoiur you want to achive? |
This post was updated on .
I am aware that the bounds of a rotated object remain the same.
But I want to create different 2D contours of the object, that I see always from the front. In principle, three views of the object, from the top, side and front. For this I use the actor, which is converted into a vtkPolyData. Then I use various vtkCutter with the generated PolyDatas. Afterwards are generated by vtkCutter-contours vtkActor2D and is represented in a vtkCanvas. By the rotation and the bounds are my contours not on the edge of the object, but in some cases show the contour farther in the interior of object. Thats the problem. |
Snap,
that sounds complicated. Maybe you want to take a look at http://www.vtk.org/doc/nightly/html/classvtkOutlineSource.html#details though I am not sure if the boundingBox is your problem. I'd suggest another approach using vtkPlane instead of the boundingBox to create those contours. Most of the time you want a contour through the center ( SetNormal and SetOrigin for that vtkPlane from the vtkActor coordinates/orientation). pseudoCode for 1 slice missing some handling for that contourActor (like setRepresnetationToWireframe() and stuff) slicePlane = vtkPlane::New(); cutterPlane = vtkCutter::New(); cutterPlane->SetInput( yourPolyData ); cutterPlane->SetValue( 0, 0.5 ); cutterPlane->GenerateCutScalarsOn(); cutterPlane->SetCutFunction( slicePlane ); // after rotating your object just always call slicePlane->SetNormal( yourvtkObject.getX(), yvtkObject.getY(), yvtkObject.getZ()); slicePlane->SetOrigin( yourVtkObject.GetOrigin() ); yourVtkObject->getMapper()->Update(); |
Thanks for your hints, but I have solved my problem with vtkActor->RotateWXYZ().
Because the rotation angle was known, i set only my necessary parameters. Rotate my actor and convert into a vtkPolydata. That's it. Maybe that sounds a bit confusing... Anyway, my problem is solved now! |
Free forum by Nabble | Edit this page |