[vtkusers] .NET 2003 + vtkRectilinearGridToPolyDataFilter

Winfried Bilgic 4Winne at web.de
Wed Apr 27 03:13:06 EDT 2005


Hello again, 

following the inheritance diagram for the "vtkRectilinearGridToPolyDataFilter" the header include every necessary file. Otherwise why should the program know from "vtkAlgorithm" and report the error conversion between these types are not possible ?

Could it be a bug ? Or simply a different type of instanciation ?

Regards Winn


"Paul Tait - OPES" <Paul at opes.com.au> schrieb am 27.04.05 05:38:23:

Probably you need to include the header file


-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
Behalf Of Winfried Bilgic
Sent: Wednesday, 27 April 2005 4:56 AM
To: vtkusers at vtk.org
Subject: [vtkusers] .NET 2003 + vtkRectilinearGridToPolyDataFilter


Hello VtkUsers, 

sorry for that simple question, i'm new to vtk. I'm trying to extract
PolyData from the RectilinearGrid without any success. For that task i
took the "RGrid.cxx" example and added the line:

Line(72):: vtkRectilinearGridToPolyDataFilter *MyRectPolyData =
vtkRectilinearGridToPolyDataFilter::New();

ended in compile error:

RGrid.cxx(72): error C2440: 'Initialisierung': 'vtkAlgorithm *' cannot
converted into 'vtkRectilinearGridToPolyDataFilter *' 

Any idea or hint is apperciated, 

Regards Winn

####################################
#### Complete Source file
####################################

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkFloatArray.h"
#include "vtkRectilinearGrid.h"
#include "vtkRectilinearGridToPolyDataFilter.h"
#include "vtkRectilinearGridGeometryFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkProperty.h"
#include "vtkCamera.h"

int main( int argc, char *argv[] )
{
  unsigned int i;
  double x[47]={
         -1.22396, -1.17188, -1.11979, -1.06771, -1.01562, -0.963542, 
         -0.911458, -0.859375, -0.807292, -0.755208, -0.703125,
-0.651042, 
         -0.598958, -0.546875, -0.494792, -0.442708, -0.390625,
-0.338542, 
         -0.286458, -0.234375, -0.182292, -0.130209, -0.078125,
-0.026042, 
          0.0260415, 0.078125, 0.130208, 0.182291, 0.234375, 0.286458, 
          0.338542, 0.390625, 0.442708, 0.494792, 0.546875, 0.598958, 
          0.651042, 0.703125, 0.755208, 0.807292, 0.859375, 0.911458, 
          0.963542, 1.01562, 1.06771, 1.11979, 1.17188};
  double y[33]={-1.25, -1.17188, -1.09375, -1.01562, -0.9375, -0.859375,

         -0.78125, -0.703125, -0.625, -0.546875, -0.46875, -0.390625, 
         -0.3125, -0.234375, -0.15625, -0.078125, 0, 0.078125, 
          0.15625, 0.234375, 0.3125, 0.390625, 0.46875, 0.546875, 
          0.625, 0.703125, 0.78125, 0.859375, 0.9375, 1.01562, 
          1.09375, 1.17188, 1.25};
  double z[44]={0, 0.1, 0.2, 0.3, 0.4, 0.5, 
         0.6, 0.7, 0.75, 0.8, 0.9, 1, 
         1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 
         1.7, 1.75, 1.8, 1.9, 2, 2.1, 
         2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 
         2.75, 2.8, 2.9, 3, 3.1, 3.2, 
         3.3, 3.4, 3.5, 3.6, 3.7, 3.75, 
         3.8, 3.9};

  vtkFloatArray *xCoords = vtkFloatArray::New();
  vtkFloatArray *yCoords = vtkFloatArray::New();
  vtkFloatArray *zCoords = vtkFloatArray::New();

  for (i=0; i<47; i++) xCoords->InsertNextValue(x[i]);
  for (i=0; i<33; i++) yCoords->InsertNextValue(y[i]);
  for (i=0; i<44; i++) zCoords->InsertNextValue(z[i]);
  
  vtkRectilinearGrid *rgrid = vtkRectilinearGrid::New();
    rgrid->SetDimensions(47,33,47);
    rgrid->SetXCoordinates(xCoords);
    rgrid->SetYCoordinates(yCoords);
    rgrid->SetZCoordinates(zCoords);

  // ******************************
  vtkRectilinearGridToPolyDataFilter *MyRectPolyData =
vtkRectilinearGridToPolyDataFilter::New();
    MyRectPolyData->SetInput(rgrid);
  // ******************************
  
    // Extract a plane from the grid to see what we've got.
  vtkRectilinearGridGeometryFilter *plane =
vtkRectilinearGridGeometryFilter::New();
    plane->SetInput(rgrid);
    plane->SetExtent(0,46, 16,16, 0,43);
    
  vtkPolyDataMapper *rgridMapper = vtkPolyDataMapper::New();
      rgridMapper->SetInput(plane->GetOutput());

  vtkActor *wireActor = vtkActor::New();
      wireActor->SetMapper(rgridMapper);
      wireActor->GetProperty()->SetRepresentationToWireframe();
      wireActor->GetProperty()->SetColor(0,0,0);

  // Create the usual rendering stuff.
  vtkRenderer *renderer = vtkRenderer::New();
  vtkRenderWindow *renWin = vtkRenderWindow::New();
    renWin->AddRenderer(renderer);
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

  renderer->AddActor(wireActor);
  renderer->SetBackground(1,1,1);
  renderer->GetActiveCamera()->Elevation(60.0);
  renderer->GetActiveCamera()->Azimuth(30.0);
  renderer->GetActiveCamera()->Zoom(1.0);
  
  renWin->SetSize(300,300);

  // interact with data
  renWin->Render();
  iren->Start();

  // Clean up
  renderer->Delete();
  renWin->Delete();
  iren->Delete();
  xCoords->Delete();
  yCoords->Delete();
  zCoords->Delete();
  rgrid->Delete();
  rgridMapper->Delete();
  wireActor->Delete();

  return 0;
}



_______________________________________________
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

-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.3 - Release Date: 25/04/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.3 - Release Date: 25/04/2005
 

_______________________________________________
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