[vtkusers] Transforming PolyData

jsl jsantam.gm at gmail.com
Wed May 9 14:28:38 EDT 2007


Hi all,

   I'm novel in VTK and I'm trying to transform a vtkOBJReader instance as
follows:

....
    // Compute the transform
    vtkMatrix4x4* Matrix4x4 = vtkMatrix4x4::New();
    computeMatrix(Matrix4x4);

    vtkTransform* Transform = vtkTransform::New();
    Transform->SetMatrix(Matrix4x4);

    // Set the 3D model
    vtkOBJReader* model3D = vtkOBJReader::New();
    model3D->SetFileName("model3D.obj");

    // Set the world transform for 3D model transformation
    vtkTransformPolyDataFilter* TransformPolyDataFilter =
vtkTransformPolyDataFilter::New();
    TransformPolyDataFilter->SetTransform(Transform);
    TransformPolyDataFilter->SetInput(model3D->GetOutput());

    model3D->Delete();  // Free the original 3D model

    // Set the 3D model mapper
    vtkPolyDataMapper* geomMap = vtkPolyDataMapper::New();
    geomMap->ImmediateModeRenderingOn();
    geomMap->SetInput(TransformPolyDataFilter->GetOutput());

    // Set the 3D model actor
    vtkActor* geomActor = vtkActor::New();
    geomActor->SetMapper(geomMap);
    geomActor->GetProperty()->SetOpacity(0.3);

    // Create the 3D model renderer
    vtkRenderer* geomRen = vtkRenderer::New();
    geomRen->AddActor(geomActor);
    geomRen->ResetCamera();
....

The problem is that I've got the same results as without considering
the transformation of the 3D model, i.e. the 3D model stays in the
same place. Why does it happens?

Also, I suppose that transforming a PolyData structure means that
it only modify the world coordinates, doesn't it?

Finally, what is the default setup of (initial conditions) the following
VTK camera features?

+ Location of the eye (in x,y,z coordinates):
+ Location of the image plane:
+ Location (behind or front of the image plane?) and
magnitude of the focal point:

I know that it can be too much questions for losing your limited time,
so I was wondering if you would be able to help me for any of this
stuff.

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070509/eaeb48c0/attachment.htm>


More information about the vtkusers mailing list