<html><head><style type="text/css">body{font:12px Arial;margin:3px;overflow-y:auto;overflow-x:auto}p{margin:0px;}blockquote, ol, ul{margin-top:0px;margin-bottom:0px;}</style></head>
<body><div style="DISPLAY: block; FONT-SIZE: 12px; FONT-FAMILY: Arial"><P>Hi,</P>
<P> </P>
<P>I have a problem with the picking. When I click on my window where there is only a triangle, I get the CellId. But I get sometime wrong values (ie 0 instead of -1 and -1 instead of 0). And if I begin to tyranslate, zoom or rotate, it's worth.</P>
<P>If someone finds where is the problem ?</P>
<P>Thank you in advance.</P>
<P> </P>
<P>Alban</P>
<P> </P>
<P> </P>
<P>A part of my code :</P>
<P> </P>
<P>private vtkCellPicker picker;</P>
<P>private vtkRenderWindowInteractor iren;</P>
<P>...</P>
<P>public MyClass() {</P>
<P> ...</P>
<P> //Add the MouseListener</P>
<P> renWin.addMouseListener(this);</P>
<P> ...</P>
<P> //Build the triangle</P>
<P> aTriangleGrid = new vtkUnstructuredGrid();<BR> vtkTriangle aTriangle = new vtkTriangle();<BR> points = new vtkPoints();<BR> points.InsertNextPoint(0,0,0);<BR> points.InsertNextPoint(2,0,0);<BR> points.InsertNextPoint(1,2,0);<BR> aTriangle.GetPointIds().SetId(0,0);<BR> aTriangle.GetPointIds().SetId(1,1);<BR> aTriangle.GetPointIds().SetId(2,2);<BR> aTriangleGrid .InsertNextCell(aTriangle.GetCellType(), aTriangle.GetPointIds());<BR> aTriangleGrid .SetPoints(points);</P>
<P> ...</P>
<P> iren = new vtkRenderWindowInteractor();</P>
<P> renWin.GetRenderWindow().SetInteractor(iren);</P>
<P>}</P>
<P>...</P>
<P>public void mouseClicked(MouseEvent e) {<BR> picker = new vtkCellPicker();<BR> picker.AddObserver("EndPickEvent", myClass.this, "annotatePick");<BR> renWin.GetRenderWindow().GetInteractor().SetPicker(picker);<BR> picker.SetTolerance(0.01);<BR> picker.Pick(e.getX(), e.getY(), 0, renWin.GetRenderer());<BR> }</P>
<P>public void annotatePick() { System.out.println(picker.GetCellId()); }</P>
<P> </P></br><p style="margin-top:11px;padding-top:3px;background-image: url(http://mail.lycos.co.uk/Images/Mail/_content/dot.gif);background-repeat: repeat-x;background-position: 0px 0px;"><b>La puissance n’est pas innée : elle se construit.</b> <a href="http://ads.lycos-europe.com/event.ng/Type=click&FlightID=190429&AdID=411354&TargetID=null&Segments=19885,2789&Targets=null&Values=243,292,24179,24195,24736,229&RawValues=&Redirect=http://www.nike.com/freeeurope/?l=fr_fr&cid=902" target="_blank">Cliquez ici pour découvrir Nike Free !</a></div></body></html>