krips89
krips89

Reputation: 1743

2D bounding box of a rendered 3D model using VTK

I am trying to find the 2D binding box of the rendered image of the 3D model using VTK. Is there anything which automatically find it for me? In the end I want to have something like this (but with the rendered image of an airplane 3D model instead of a real one): http://host.robots.ox.ac.uk/pascal/VOC/voc2007/examples/aeroplane_03.jpg

If not I'll have to go, pixel by pixel, pick points and find the extreme points myself. Just wanted to know is there is something which automatically do it for me.

Upvotes: 6

Views: 1271

Answers (1)

Ian
Ian

Reputation: 1716

It really depends on what data type you have. For vtkPolyData you can just call PolyDataObject.GetBounds() and you will get the extreme points of your object in the format -x, x, -y, y, -z, z.

There is also a function vtkBoundingBox that seems to do what you want.

In the end you should be able to solve this with something like BoundingBox.SetBounds(Object.GetBounds()).

Edit: As described in another thread, if you do not have a vtkPolyData object you can usually call someObject.GetOutput().GetBounds().

Upvotes: 2

Related Questions