VTK:启动列表或3x3矩阵数组

时间:2016-03-23 12:11:14

标签: vtk

标题说明了一切,我可以制作3x3矩阵的列表或数组吗?如果是这样,怎么样?我尝试过使用vtkSmartPointer<vtkDataArrayTemplate<vtkMatrix3x3>> inV = vtkSmartPointer<vtkDataArrayTemplate<vtkMatrix3x3>>::New();。然后它给出了如下错误,

1>c:\vtk\src\common\core\vtkTypedDataArray.h(68): error C2027: use of undefined type 'vtkTypeTraits<T>'
1>with
1>[
1>      T=vtkMatrix3x3
1>]
1>c:\vtk\src\common\core\vtkTypeTemplate.h(38) : see reference to class template instantiation 'vtkTypedDataArray<Scalar>' being compiled
1>with
1>[
1>      Scalar=vtkMatrix3x3
1>]
1>C:\vtk\src\Common\Core\vtkDataArrayTemplate.h(35) : see reference to class template instantiation 'vtkTypeTemplate<ThisT,BaseT>' being compiled
1>with
1>[
1>      ThisT=vtkDataArrayTemplate<vtkMatrix3x3>,
1>      BaseT=vtkTypedDataArray<vtkMatrix3x3>
1>]
1>C:\vtk\src\Common\Core\vtkSmartPointer.h(117) : see reference to class template instantiation 'vtkDataArrayTemplate<T>' being compiled
1>with
1>[
1>      T=vtkMatrix3x3
1>]
1>C:\vtk\src\Common\Core\vtkSmartPointer.h(116) : while compiling class template member function 'vtkSmartPointer<T> vtkSmartPointer<T>::New(void)'
1>with
1>[
1>      T=vtkDataArrayTemplate<vtkMatrix3x3>
1>]

谢谢..

2 个答案:

答案 0 :(得分:0)

好的,我可以使用C ++和VTK的组合实现这一点。

vtkMatrix3x3 **mat = new vtkMatrix3x3*[src_obj->getObject()->GetNumberOfCells()];

任何更好的方法都会被标记为正确的答案..

答案 1 :(得分:0)

错误说明当您要创建vtkDataArrayTemplate<T>时,它涉及创建以下类: vtkTypeTraits<T>vtkTypedDataArray<T>,这两个类期望标量作为模板参数T. 你给它一个9的矩阵值,所以它不能工作。

vtkDataArrayTemplate类主要用于包含标量。

您可以使用例如vtkMatrix3x3更轻松地创建std::vector数组:

std::vector<vtkMatrix3x3> inV;