[vtkusers] VTK_USE_MATLAB_MEX VTK6

kwayeke bigvision82 at yahoo.com
Tue Aug 19 17:54:14 EDT 2014


Did you run this example 
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); 
} 

I need an example to test if it's working . I have matlab 2014a on both mac
and windows .




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


More information about the vtkusers mailing list