Graphics-VTK
view release on metacpan or search on metacpan
examples/old_examples/graphics/smoothLines.pl view on Meta::CPAN
# create a semi-cylinder
$line = Graphics::VTK::LineSource->new;
$line->SetPoint1(0,0,1);
$line->SetPoint2(50,0,1);
$line->SetResolution(49);
$bump = Graphics::VTK::BrownianPoints->new;
$bump->SetInput($line->GetOutput);
$warp = Graphics::VTK::WarpVector->new;
$warp->SetInput($bump->GetPolyDataOutput);
$warp->SetScaleFactor('.1');
$iterations = "0 10 20 30 40 50";
foreach $iteration ($iterations)
{
$smooth{$iteration} = Graphics::VTK::SmoothPolyDataFilter->new;
$smooth{$iteration}->SetInput($warp->GetOutput);
$smooth{$iteration}->SetNumberOfIterations($iteration);
$smooth{$iteration}->BoundarySmoothingOn;
$smooth{$iteration}->SetFeatureAngle(120);
$smooth{$iteration}->SetEdgeAngle(90);
$smooth{$iteration}->SetRelaxationFactor('.025');
$smooth{$iteration}->GenerateErrorScalarsOn;
$lineMapper{$iteration} = Graphics::VTK::PolyDataMapper->new;
( run in 2.392 seconds using v1.01-cache-2.11-cpan-71847e10f99 )