VTK三角面片

/*
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSphereSource.h"
#include "vtkShrinkFilter.h"
#include "vtkElevationFilter.h"
#include "vtkDataSetMapper.h"
#include "vtkActor.h"
#include "vtkCullerCollection.h"

 

void main( int argc, char *argv[] )
{
    vtkRenderer *renderer = vtkRenderer::New();
    renderer->GetCullers()->RemoveAllItems();
    vtkRenderWindow *renWin = vtkRenderWindow::New();
    renWin->AddRenderer(renderer);
    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);
    vtkSphereSource *sphere = vtkSphereSource::New();
    sphere->SetThetaResolution(12); sphere->SetPhiResolution(12);
    vtkShrinkFilter *shrink = vtkShrinkFilter::New();
    shrink->SetInput((vtkDataSet *)sphere->GetOutput());
    shrink->SetShrinkFactor(0.9);

    vtkElevationFilter *colorIt = vtkElevationFilter::New();
    colorIt->SetInput((vtkDataSet *)shrink->GetOutput());
    colorIt->SetLowPoint(0,0,-0.5);
    colorIt->SetHighPoint(0,0,0.5);


    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
    mapper->SetInput(colorIt->GetOutput());

    vtkActor *actor = vtkActor::New();
    actor->SetMapper(mapper);
    renderer->AddActor(actor);
    renderer->SetBackground(1,1,1);
    renWin->SetSize(400,400);

    renWin->Render(); // execute first time

 

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

    // Clean up
    renderer->Delete();
    renWin->Delete();
    iren->Delete();
    sphere->Delete();
    shrink->Delete();
    colorIt->Delete();
    mapper->Delete();
    actor->Delete();
}
*/

posted @ 2010-10-12 20:27  白了少年头  阅读(1440)  评论(0编辑  收藏  举报