<html><div style='background-color:'><DIV>
<P>Dear friends,</P>
<P> Any help to find mistake in the following would be greatly appreciated;I have marked the line in red at the bottom.Thanks in advance.</P>
<P>----------------------------------------------------------------------------------------------------------------------------</P>
<P>// reads cow.g file</P>
<P><FONT size=1>vtkBYUReader *cow = vtkBYUReader::New();</FONT></P>
<P><FONT size=1> cow->SetGeometryFileName(cow.g);</FONT></P>
<P><FONT size=1> cow->Update();</FONT></P>
<P><FONT size=1>vtkPolyDataNormals *cowNormals = vtkPolyDataNormals::New();</FONT></P>
<P><FONT size=1> cowNormals->SetInputConnection(cow->GetOutputPort());</FONT></P>
<P><FONT size=1>vtkPolyDataMapper *cowMapper = vtkPolyDataMapper::New();</FONT></P>
<P><FONT size=1> cowMapper->SetInput(cowNormals-> GetOutput());</FONT></P>
<P><FONT size=1>vtkActor *cowActor = vtkActor::New();</FONT></P>
<P><FONT size=1> cowActor->SetMapper( cowMapper );</FONT></P>
<P><FONT size=1>// determines the origin and normal of the cutting plane</FONT></P>
<P><FONT size=1>double point[3] = {0.0,0.0,0.0};</FONT></P>
<P><FONT size=1>double normal[3] = {1.0,0.0,0.0};</FONT></P>
<P><FONT size=1>int inputNumberOfPoints = -1;</FONT></P>
<P><FONT size=1>int cutterNumberOfPoints = -1;</FONT></P>
<P><FONT size=1>int stripperNumberOfPoints = -1;</FONT></P>
<P><FONT size=1>//instantiates the plane and sets the origin and normal</FONT></P>
<P><FONT size=1>vtkPlane *plane = </FONT><FONT size=1>vtkPlane::New();</FONT></P>
<P><FONT size=1> plane->SetOrigin(point);</FONT></P>
<P><FONT size=1> plane->SetNormal(normal);</FONT></P>
<P><FONT size=1>vtkCutter *cutter </FONT><FONT size=1>= vtkCutter::New();</FONT></P>
<P><FONT size=1> cutter->SetInput(cow->GetOutput());</FONT></P>
<P><FONT size=1> cutter->SetCutFunction(plane);</FONT></P>
<P><FONT size=1> cutter->Update();</FONT></P>
<P><FONT size=1></FONT></P>
<P><FONT size=1>inputNumberOfPoints = cow->GetOutput()->GetNumberOfPoints();</FONT></P>
<P><FONT size=1></FONT></P>
<P><FONT size=1>vtkStripper *stripper = vtkStripper::New();</FONT></P>
<P><FONT size=1> stripper->SetInput(cutter->GetOutput());</FONT></P>
<P><FONT size=1> stripper->Update();</FONT></P>
<P><FONT size=1>vtkPolyData *cutPoly = vtkPolyData::New(); </FONT></P>
<P><FONT size=1> cutPoly->SetPoints (stripper->GetOutput()->GetPoints());</FONT></P>
<P><FONT size=1> cutPoly->SetPolys (stripper->GetOutput()->GetLines());</FONT></P>
<P><FONT size=1>vtkPolyDataMapper *cutMapper = vtkPolyDataMapper::New();</FONT></P>
<P><FONT size=1> cutMapper->SetInput(cutPoly);</FONT></P>
<P><FONT size=1>vtkActor *cutActor = vtkActor::New();</FONT></P>
<P><FONT size=1> cutActor->SetMapper( cutMapper );</FONT></P>
<P><FONT size=1>stripperNumberOfPoints = cutter->GetOutput()->GetNumberOfPoints();</FONT></P>
<P><FONT size=1>double cutterPoint[3];</FONT></P>
<P><FONT size=1>//choose the arbitrary poiint on cutter with id = 0;</FONT></P>
<P><FONT size=1>int pID = 0;</FONT></P>
<P><FONT size=1>cutter->GetOutput()->GetPoint(pID,cutterPoint);</FONT></P>
<P><FONT size=1>cout << cutterPoint[0] << " " << cutterPoint[1] << " "<< cutterPoint[2] << "\n";</FONT></P>
<P><FONT size=1>int pointID = 0;</FONT></P>
<P><FONT size=1>//find the corresponding point id on cow </FONT></P>
<P><FONT size=1>pointID = cow->GetOutput()->FindPoint(cutterPoint);</FONT></P>
<P><FONT size=1>cout << pointID << "\n";</FONT></P>
<P><FONT color=#ff0033 size=1><STRONG>float* normals = (float*)cow->GetOutput()->GetPointData()->GetNormals()->GetTuple(pointID);<--- </STRONG></FONT></P>
<P><FONT color=#ff0033 size=1><STRONG>This line above has got the bug.What is going wrong?</STRONG></FONT></P>
<P><FONT size=1></FONT> </P></DIV></div><br clear=all><hr>Express yourself instantly with MSN Messenger! <a href="http://g.msn.com/8HMAEN/2731??PS=47575" target="_top">MSN Messenger</a> Download today it's FREE!</html>