<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi David</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Have a look at vtkWarpScalar.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>HTH</FONT></DIV>
<DIV><FONT face=Arial size=2>Malcolm</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=davidmichell@rediffmail.com
href="mailto:davidmichell@rediffmail.com">david michell</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org
href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, April 24, 2004 6:18
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] 3D Contours?</DIV>
<DIV><BR></DIV>
<P> Hi Everyone,<BR>I have taken all your reply and used them to make
the 2D contour plot.<BR>Thanks a lot for the help.<BR><BR>The contour plots
are now 2D, they are just lines.<BR>What should I do to make them 3D ie to
show surfaces?<BR>Also tell me if i can improve this code anyway?<BR>I have
put the code that I did for 2D Contour plot.<BR><BR>Please help me.<BR>Thank
you,<BR>David Michell<BR><BR>void main()<BR>{<BR>int
npts=100;<BR><BR>vtkPoints *
points=vtkPoints::New();<BR>points->SetNumberOfPoints(npts);<BR><BR>vtkPolyVertex
*pv=vtkPolyVertex::New();<BR>pv->GetPointIds()->SetNumberOfIds(npts);<BR><BR>vtkDoubleArray
*scalar=vtkDoubleArray::New();<BR>scalar->SetNumberOfTuples(npts);<BR><BR>double
*data=new double[npts];<BR>for (int
i=0;i<npts;i++)<BR>{<BR>data[i*3+0]=sin((double)i);<BR>data[i*3+0]=cos((double)i);<BR>data[i*3+0]=0.0;//(double)i/npts;<BR><BR>if
(i<25) scalar->InsertValue(i,0.0);<BR>if ((i>=25)&&(i<50))
scalar->InsertValue(i,1.0);<BR>if ((i>=50)&&(i<75))
scalar->InsertValue(i,2.0);<BR>if ((i>=75)&&(i<100))
scalar->InsertValue(i,3.0);<BR>}<BR><BR>vtkUnstructuredGrid
*grid=vtkUnstructuredGrid::New();<BR>grid->Allocate(npts*3);<BR>grid->SetPoints(points);<BR>grid->InsertNextCell(pv->GetCellType(),pv->GetPointIds);<BR>grid->GetPointData()->SetScalars(scalar);<BR>grid->Modified();<BR>grid->Update();<BR><BR>vtkDelaunay2D
*del=vtkDelaunay2D::New();<BR>del->SetInput(grid);<BR>del->SetTolerance(0.00001);<BR><BR>/*********TO
MAKE THE CONTOUR LINES WITH SMOOTH
CURVES************/<BR>vtkButterflySubdivisionFilter
*butr=vtkButterflySubdivisionFilter::New();<BR>butr->SetInput(del->GetOutput());<BR>butr->SetNumberOfSubdivisions(3);<BR><BR>vtkReverseSense
*rev=vtkReverseSense::New();<BR>rev->SetInput(rev->GetOutput());<BR>rev->ReverseCellsOn();<BR>rev->ReverseNormalsOn();<BR>/*************************OK
DONE! CURVES***************************/<BR><BR>vtkMarchingContourFilter
*contour2D=vtkMarchingContourFilter::New();<BR>contour2D->SetInput(rev->GetOutput());<BR>contour2D->GenerateValues(4,0.0,3.0);<BR>contour2D->Update();<BR><BR>vtkLookupTable
*lut=vtkLookupTable::New();<BR>lut->SetHueRange(0.6,0);<BR>lut->SetSaturationRange(1.0,0);<BR>lut->SetValueRange(0.5,1.0);<BR><BR>/*<BR>The
rest of the code PolyDataMapper, Actor, Renderer, RenderWindow and
RenderWindowInteractor go here!<BR>*/<BR><BR>}
<BR><BR><BR><BR><BR></P><BR><BR><A
href="http://clients.rediff.com/signature/track_sig.asp" target=_blank><IMG
hspace=0
src="http://ads.rediff.com/RealMedia/ads/adstream_nx.cgi/www.rediffmail.com/inbox.htm@Bottom"
border=0></A> </BLOCKQUOTE></BODY></HTML>