[vtkusers] How to draw contourlines on a Cone?
John Platt
jcplatt at dsl.pipex.com
Mon Nov 27 19:00:54 EST 2006
Hi,
Where have you defined the data to be contoured?
You could try adding some point scalars -
vtkPolyData* conePolyData = cone->GetOutput();
conePolyData->Update();
vtkDoubleArray* scalars = vtkDoubleArray::New();
conePolyData->GetPointData()->SetScalars( scalars );
scalars->Delete();
const int numPts = conePolyData->GetNumberOfPoints();
for ( int ii = 0; ii < numPts; ++ii )
{
double* xyz = conePolyData->GetPoints()->GetPoint( ii );
double x = xyz[0]; // -1.5 to + 1.5
scalars->InsertTuple( ii, &x );
}
Then create the mapper and set the scalar range -
coneMapper->SetScalarRange( -1.5, 1.5 );
HTH
John.
-----Original Message-----
From: vtkusers-bounces+jcplatt=dsl.pipex.com at vtk.org
[mailto:vtkusers-bounces+jcplatt=dsl.pipex.com at vtk.org] On Behalf Of
beth at portugalmail.pt
Sent: 27 November 2006 12:21
To: vtkusers at vtk.org
Cc: ecarvalho at dsi.uminho.pt
Subject: [vtkusers] How to draw contourlines on a Cone?
Hi,
I would like to draw a cone, and according Y coordinate values, paint it
differently. On other words, I want to create contour lines/surfaces on
the
cone. My idea is to use a cone to map distribution values of my data
(lower to
higher values, accumulative distribution). So it should be made of
several
slices with different colors and thickness.
My piece of code that is not working:
vtkConeSource *cone = vtkConeSource::New();
cone->SetHeight( 3.0 ); // I suppose it y value goes from 0 to 3.0...
cone->SetRadius( 1.0 );
cone->SetResolution( 10 );
vtkContourFilter* contour = vtkContourFilter::New();
contour->SetInputConnection(cone->GetOutputPort());
contour->SetValue ( 1, 0.1); // try to create 2 contours, on position
y=0.1
and 0.2
contour->SetValue ( 2, 0.2);
vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();
contourMapper->SetInputConnection( contour->GetOutputPort() );
vtkActor *contourActor = vtkActor::New();
contourActor->SetMapper( contourMapper );
// usual rendering stuff...
My goal is to control the contour generation according to y coordinate
value
on the cone, but it's not working at all!
Thanks for any help/tip!
Best regards,
Elizabeth
__________________________________________________________
Continua a preferir gastar mais?
Compare o preço da sua ligação à Internet
http://acesso.portugalmail.pt/compare
_______________________________________________
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