[vtkusers] Translation and scaling

Paul Tait paul at opes.com.au
Sun Dec 21 23:58:44 EST 2003


Hi All

Well my last post didn't get any takers so I'll try a different tack

my data has the following range

Bounds:
Xmin,Xmax: (545700, 549900)
Ymin,Ymax: (9.96e+006, 9.9656e+006)
Zmin,Zmax: (-6138, -5455)

I would like to translate (I think thats the correct term) the data so that
it sits around the 0,0,0 origin. I need this so when I Scale() my data in
the Z axis it increases uniformly above and below the origin and gives me an
exagerrated or bumpier surface

I'm trying

float bounds[6];
Threed->GetBounds(bounds);
vtkTransform *trans = vtkTransform::New();
trans->Translate(-(bounds[0] + (bounds[1] - bounds[0]) / 2),
                            -(bounds[2] + (bounds[3] - bounds[3]) / 2),
                            -(bounds[4] + (bounds[5] - bounds[4]) / 2));

prop->SetUserTransform(trans);

I've also tried

prop->AddPosition(-(bounds[0] + (bounds[1] - bounds[0]) / 2),
                             -(bounds[2] + (bounds[3] - bounds[3]) / 2),
                             -(bounds[4] + (bounds[5] - bounds[4]) / 2));

but I'm not getting the same effect as I used to when I adjusted my source
data before adding it to the various vtk objects I use

Thanks Paul




More information about the vtkusers mailing list