[vtkusers] rotate vtkPoints with vtkTransform

Malcolm Drummond malcolm at geovision.co.za
Thu Jul 7 05:52:58 EDT 2005


Hi Burlen

In short, Points and Normals are different things - treating them as though 
they share the same origin is wrong. The filter will handle Normals 
appropriately. From the docs ...

"vtkTransformPolyDataFilter is a filter to transform point coordinates and 
associated point and cell normals and vectors."

Malcolm Drummond
GeoVision cc

----- Original Message ----- 
From: "Burlen" <burlen at apollo.sr.unh.edu>
To: "Malcolm Drummond" <malcolm at geovision.co.za>
Cc: <vtkusers at vtk.org>
Sent: Tuesday, July 05, 2005 8:06 PM
Subject: Re: [vtkusers] rotate vtkPoints with vtkTransform


> Hi, Malcom, thanks for the help.
>
> It still isn't working quite right. I'm trying a simplified version on two
> pionts (center and normal) using translate only. The center point gets
> translated correctly, but the normal point doesn't.  I've never had to 
> work
> with polydata directly, and I was wondering if you see anything that jumps
> out as wrong in my code?
>
> void fmConfigCutPlane::Rx()
> {
>    double theta = ledRot->text().toDouble();
>
>    double *normal = pwid->GetNormal();
>    double *center = pwid->GetOrigin();
>
>    vtkPoints *data = vtkPoints::New();
>    data->SetDataTypeToDouble();
>    data->SetNumberOfPoints(2);
>    data->SetPoint(0, center);
>    data->SetPoint(1, normal);
>
>    vtkCellArray *cell = vtkCellArray::New();
>    cell->InsertNextCell(2);
>    cell->InsertCellPoint(0);
>    cell->InsertCellPoint(1);
>
>    vtkPolyData *pdata = vtkPolyData::New();
>    pdata->SetPoints(data);
>    pdata->SetLines(cell);
>
>    vtkTransform *T = vtkTransform::New();
>    T->Translate(-1.0*center[0], -1.0*center[1], -1.0*center[2]);
>    //T->RotateX(theta);
>    //T->Translate(center[0], center[1], center[2]);
>
>    vtkTransformFilter *Tf = vtkTransformFilter::New();
>    Tf->SetInput(pdata);
>    Tf->SetTransform(T);
>    Tf->Update();
>
>
>    vtkPoints *Tdata = Tf->GetOutput()->GetPoints();
>
>    center = Tdata->GetPoint(0);
>    normal = Tdata->GetPoint(1);
>
>    pwid->SetOrigin(Tdata->GetPoint(0));
>    pwid->SetNormal(Tdata->GetPoint(1));
>    thisModule->broadcastMessage(PROPAGATE_DOWN, REPAINT);
>
> }
>
> On Tuesday 05 July 2005 11:36 am, Malcolm Drummond wrote:
>> Hi Burlen
>>
>> Use a vtkTransformPolyDataFilter (this will require a vtkTransform as 
>> well
>> as an input) and just call Update on the filter - after which you can
>> accesss the transformed points through GetOutput.
>>
>> HTH
>> Malcolm Drummond
>> GeoVision cc
>>
>> ----- Original Message ----- 
>> From: "Burlen" <burlen at apollo.sr.unh.edu>
>> To: <vtkusers at vtk.org>
>> Sent: Tuesday, July 05, 2005 5:08 PM
>> Subject: [vtkusers] rotate vtkPoints with vtkTransform
>>
>>
>> > Hi does anyone know how to rotate just vtkPoints? I have my data in
>> > vtkPoints, I want to rotate them about an axis, then get the result,
>> > without ever rendering them.
>> > All the examples I have seen work with objects that have SetTransform
>> > method, and then you don't ever get the result, it apears in the 
>> > rendered
>> > scene. vtkPoints doesn't have a SetTransform method...
>> >
>> > ANy ideas?
>> > _______________________________________________
>> > This is the private VTK discussion list.
>> > Please keep messages on-topic. Check the FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>>
> 




More information about the vtkusers mailing list