[vtkusers] VTK_USE_MATLAB_MEX VTK6

kwayeke bigvision82 at yahoo.com
Fri Jul 4 13:56:02 EDT 2014


Thanks Jameson. I will take a look. I have manage to compile it somehow

Were you able to run the  example below from  
http://www.kitware.com/media/html/MATLABAndGNURIntegrationWithVTK.html ?
I am getting this output with nothing shown in the rendering window:
 ALGORITHM_AFTER_FORWARD: 1
  FORWARD_DIRECTION: 0
  FROM_OUTPUT_PORT: 0

I believe the "Normals" in   ef->PutArray("Normals", "N") might be passing 0
to the function.


#include “vtkMatlabEngineFilter.h”
#include “vtkSphereSource.h”
#include “vtkWarpVector.h”

int main()
{

vtkSmartPointer<vtkSphereSource> ss =
vtkSmartPointer<vtkSphereSource>::New();
    vtkSmartPointer<vtkMatlabEngineFilter> ef
=vtkSmartPointer<vtkMatlabEngineFilter>::New();
    vtkSmartPointer<vtkWarpVector> wv =
vtkSmartPointer<vtkWarpVector>::New();
    
    ss->SetThetaResolution(100);
    ss->SetPhiResolution(100);
    
      ef->SetInputConnection(ss->GetOutputPort());
     vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
    
     ef->PutArray("Normals", "N");
     
     ef->SetMatlabScript(
     "rv = randi([-1,1],size(N,1),1);\
     N(:,1) = N(:,1).*rv;\
     N(:,2) = N(:,2).*rv;\
     N(:,3) = N(:,3).*rv;");
     
     ef->GetArray("N", "N");
     
     wv->SetInputData(ef->GetOutput());
      wv->Update();
     

     vtkSmartPointer<vtkPolyDataMapper> Mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
  Mapper->SetInputData(wv->GetPolyDataOutput());
     vtkSmartPointer<vtkActor> Actor = vtkSmartPointer<vtkActor>::New();
     Actor->SetMapper(Mapper);
} 








--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-USE-MATLAB-MEX-VTK6-tp5727707p5727751.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list