<!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.1264" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff background="">
<DIV>
<DIV><FONT face=宋体 size=2>Hi, all</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>Following is my pipeline:</FONT></DIV>
<DIV><FONT face=宋体 size=2><FONT color=#008080>(<STRONG>1) But I cannot get
the contour.</STRONG></FONT></FONT></DIV>
<DIV><STRONG><FONT face=宋体 color=#008080 size=2></FONT></STRONG> </DIV>
<DIV><FONT face=宋体 color=#008080 size=2><STRONG>(2) for vtkDelaunay2D, if I
don't apply vtkDelaunay2D::update()</STRONG></FONT></DIV>
<DIV><FONT face=宋体 color=#0000ff size=2><STRONG><FONT
color=#008080> The output polydata from vtkDelaunay2D
will be with</FONT> <FONT color=#ff0000>0 cell</FONT>.</STRONG></FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 color=#008000
size=2>///////////////////////////////////////////////////////////////////////////////////</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2><FONT color=#0000ff><STRONG>int</STRONG></FONT>
i;</FONT></DIV>
<DIV><FONT face=宋体 size=2>vtkFloatArray* pcoords =
vtkFloatArray::New();</FONT></DIV>
<DIV><FONT face=宋体 size=2>pcoords->SetNumberOfComponents(<FONT
color=#800000><STRONG>3</STRONG></FONT>);<BR>pcoords->SetNumberOfTuples(<STRONG><FONT
color=#800000>10512</FONT></STRONG>);<BR></FONT></DIV>
<DIV><FONT face=宋体 size=2><FONT color=#0000ff><STRONG>float</STRONG></FONT>
pts[<FONT color=#800000><STRONG>10512</STRONG></FONT>][<FONT
color=#800000><STRONG>3</STRONG></FONT>];<BR><FONT
color=#0000ff><STRONG>float</STRONG></FONT> * temdata = new float[<STRONG><FONT
color=#800000>10512</FONT></STRONG>]; <BR><FONT color=#008080><FONT
color=#008000>/////////////////////////////////////////////////////////////////////////////////////</FONT><BR></FONT>nc_reader
myreader("test.dat");</FONT></DIV>
<DIV><FONT face=宋体 size=2>if (!(myreader.get_float_2d(temdata,<STRONG><FONT
color=#800000>2000</FONT></STRONG>))) return false;</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 color=#008000 size=2>// This is my function to read data from
file, it is OK.</FONT></DIV>
<DIV><FONT face=宋体 color=#008000 size=2>// The grid is global meteorological
data 2.5x2.5 </FONT></DIV>
<DIV><FONT face=宋体 size=2><FONT
color=#008000>//////////////////////////////////////////////////////////////////////////////////////</FONT><BR><FONT
color=#0000ff><STRONG>int</STRONG></FONT> indexs= <STRONG><FONT
color=#800000>0</FONT></STRONG>;<BR><FONT
color=#0000ff><STRONG>float</STRONG></FONT> ii,jj;<BR><STRONG><FONT
color=#0000ff>for</FONT></STRONG> (ii =<STRONG><FONT
color=#800000>90</FONT></STRONG>;ii>=<STRONG><FONT
color=#800000>-90</FONT></STRONG> ;ii = ii-<FONT
color=#800000><STRONG>2.5</STRONG></FONT>)<BR>{<BR> <STRONG><FONT
color=#0000ff> </FONT></STRONG><FONT
color=#0000ff><STRONG>for</STRONG></FONT> (jj = 0 ;jj<=<FONT
color=#800000>357.5</FONT>;jj =jj+<FONT
color=#800000>2.5</FONT>)<BR> {<BR>
indexs =(<FONT color=#0000ff><STRONG>int</STRONG></FONT>)((<FONT
color=#800000>90</FONT>-ii)/<FONT color=#800000>2.5</FONT>) * <FONT
color=#800000>144</FONT> + (<STRONG><FONT
color=#0000ff>int</FONT></STRONG>)(jj/<FONT
color=#800000>2.5</FONT>);<BR> pts[indexs][<FONT
color=#800000>0</FONT>] = jj;pts[indexs][<FONT color=#800000>1</FONT>] = ii;
pts[indexs][<FONT color=#800000>2</FONT>] = <FONT
color=#800000>0</FONT>;<BR>
}<BR> <BR>}</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2><FONT color=#0000ff><STRONG>for</STRONG></FONT>
(i=<FONT color=#800000>0</FONT>; i<<FONT color=#800000>10512</FONT>;
i++)<BR> pcoords->SetTuple(i, pts[i]);</FONT></DIV>
<DIV><FONT face=宋体 size=2> </DIV></FONT>
<DIV><FONT face=宋体 size=2>vtkPoints* points =
vtkPoints::New();<BR>points->SetData(pcoords);</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> </FONT><FONT face=宋体 size=2></FONT></DIV>
<DIV><FONT face=宋体 size=2>vtkIntArray* temperature =
vtkIntArray::New();<BR>temperature->SetName("Temperature");<BR><STRONG><FONT
color=#0000ff>for</FONT></STRONG> (i=<FONT color=#800000>0</FONT>; i<<FONT
color=#800000>10512</FONT>; i++)<BR>{<BR>
temperature->InsertNextValue(temdata[i]);<BR>}</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>vtkPolyData* polydata =
vtkPolyData::New();<BR><BR>polydata->SetPoints(points);<BR><BR>polydata->GetPointData()->SetScalars(temperature);<BR></FONT></DIV>
<DIV><FONT face=宋体 size=2>vtkDelaunay2D* del2 =
vtkDelaunay2D::New();<BR>vtkContourFilter * cf
=vtkContourFilter::New();<BR><BR> <BR>del2->SetInput(polydata);<BR><BR>del2->Update();
<STRONG><FONT color=#008000>// if no update GetNumberOfCells() ==0 ,
why??<BR></FONT><FONT color=#808000>std::</FONT><FONT
color=#0000ff>cout</FONT></STRONG><<"cell size:"<<
del2->GetOutput()->GetNumberOfCells()<<std::endl; </FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>cf->SetInput(del2->GetOutput());<BR></FONT><FONT
face=宋体 size=2><BR>vtkPolyDataMapper* mapper =
vtkPolyDataMapper::New();<BR>mapper->SetInput(cf->GetOutput());</DIV>
<DIV> </DIV>
<DIV></FONT> </DIV>
<DIV><FONT face=宋体 size=2>vtkActor* actor =
vtkActor::New();<BR>actor->SetMapper(mapper);<BR>vtkRenderer* ren =
vtkRenderer::New();<BR>ren->AddActor(actor);<BR>ren->SetBackground(0.2,0.2,0.4); <BR>vtkRenderWindow*
renWin = vtkRenderWindow::New();<BR>renWin->AddRenderer(ren);</FONT></DIV>
<DIV><FONT face=宋体 size=2>vtkRenderWindowInteractor* iren =
vtkRenderWindowInteractor::New();<BR>iren->SetRenderWindow(renWin);<BR>iren->Initialize();<BR>iren->Start();</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体
size=2>pcoords->Delete();<BR>points->Delete();<BR>cells->Delete();<BR>temperature->Delete();</FONT></DIV>
<DIV><FONT face=宋体
size=2>polydata->Delete();<BR>mapper->Delete();<BR>actor->Delete();<BR>ren->Delete();<BR>renWin->Delete();<BR>iren->Delete();<BR>delete
[]temdata;<BR></FONT><FONT face=宋体 size=2></FONT><FONT face=宋体 size=2><FONT
face=宋体 size=2></FONT></DIV></FONT>
<DIV><FONT face=宋体 size=2></FONT> </DIV></DIV></BODY></HTML>