应用Transformation后如何更新Actor?

时间:2017-02-28 03:38:46

标签: vtk

目前,我通过以下代码将译文应用于演员:

vtkSmartPointer<vtkTransform> translation =
    vtkSmartPointer<vtkTransform>::New();
translation->PostMultiply(); //this is the key line
translation->Translate(translationVector);
patella->getActor()->SetUserTransform(translation);

但是,如果我申请

patella->getActor()->SetUserTransform(translation);

一次。演员保持在相同的位置,好像我只应用了一次。我知道这是因为原点没有更新。那么,如何在每次翻译后更新原点/演员?

1 个答案:

答案 0 :(得分:2)

您想要连接转换。类似的东西:

vtkActor* patellaActor = patella->GetActor();
vtkTransform* patellaXfm = patellaActor->GetUserTransform();
if (!patellaXfm) {
    patellaActor->SetUserTransform(translation);
} else {
    patellaXfm->Concatenate(translation);
}