<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">Hi,<br>
(again) I solved the problem. For who's interested, here's the solution:<br>
<br>
1. use the version of IntersectWithLine returning also the id of the
intersecting cell<br>
locator-&gt;IntersectWithLine(startPnt, endPnt, tolerance,
lineParameter, intersect, paraCoord, sub_id,&nbsp; cellId)<br>
<br>
2. get the list of vertices of the cell:<br>
<br>
&nbsp;&nbsp;&nbsp; vtkIdList* nghList = vtkIdList::New();<br>
&nbsp;&nbsp;&nbsp;&nbsp; source-&gt;GetCellPoints(cellId, nghList);<br>
<br>
3. iterate through the points in order to get their texture coordinates
and interpolate them in the intersection position<br>
<br>
4. with the (interpolated) texture coordinates, access the texture
image to get the RGB point color (i use simple linera interpolation
between image pixels)<br>
<br>
bye,<br>
a.<br>
<br>
</font></font><br>
Andrea Bottino wrote:
<blockquote cite="mid:4B866B1D.40407@polito.it" type="cite">
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
  <font size="-1"><font face="Verdana">Hi everybody,<br>
  <br>
I solved the previous problem using vtkCellLocator. for who's
interested, given a vtkPolyData source the code is:<br>
  <br>
  <br>
&nbsp;&nbsp; // the cell locator<br>
&nbsp;&nbsp; vtkCellLocator* locator = vtkCellLocator::New();<br>
&nbsp;&nbsp; locator-&gt;SetDataSet(source);<br>
&nbsp;&nbsp; locator-&gt;CacheCellBoundsOn();<br>
&nbsp;&nbsp; locator-&gt;AutomaticOn();<br>
&nbsp;&nbsp; locator-&gt;BuildLocator();<br>
  <br>
&nbsp;&nbsp; // init the interesection parameters<br>
&nbsp;&nbsp; double tolerance = 0.001, lineParameter, intersect[3], paraCoord[3];<br>
&nbsp;&nbsp; double startPnt[3] = {// add coordinates of start point here}, <br>
&nbsp;&nbsp;&nbsp; endPnt[3] = {</font></font><font size="-1"><font face="Verdana">//
add coordinates of end point here</font></font><font size="-1"><font
 face="Verdana">};<br>
&nbsp;&nbsp; int sub_id;<br>
  <br>
  <br>
&nbsp;&nbsp; if(locator-&gt;IntersectWithLine(startPnt, endPnt, tolerance,
lineParameter, intersect, paraCoord, sub_id))<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; printf("Point intersection: (%.2f, %.2f, %.2f)\n", intersect[0],
intersect[1], intersect[2]);<br>
&nbsp;&nbsp;&nbsp; // do something with the intersection point<br>
&nbsp;&nbsp; }<br>
  <br>
  <br>
&nbsp;&nbsp; locator-&gt;Delete();<br>
  <br>
  <br>
now I have a new problem (as you can see I'm not a big expert of vtk...)<br>
The vtkPolyData comes from a textured model. Is there a way to get
easily the colour of the intersection point (considering that probably
it is not a vertex of the mesh)?<br>
  <br>
regards,<br>
a.<br>
  <br>
  <br>
  </font></font>
  <pre class="moz-signature" cols="72">-- 
Andrea Bottino
Politecnico di Torino, DAUIN
Corso Duca degli Abruzzi, 24
10129 Torino ITALY
Tel +39 011 5647175 / Fax +39 011 5647099.
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://www.polito.it/cgvg">http://www.polito.it/cgvg</a>
  </pre>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Andrea Bottino
Politecnico di Torino, DAUIN
Corso Duca degli Abruzzi, 24
10129 Torino ITALY
Tel +39 011 5647175 / Fax +39 011 5647099.
<a class="moz-txt-link-freetext" href="http://www.polito.it/cgvg">http://www.polito.it/cgvg</a>
</pre>
</body>
</html>