<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      I think these lines in the for-loop are wrong:<br>
      <br>
      &nbsp;&nbsp;&nbsp; points-&gt;GetPoint(num-1,punto);<br>
      &nbsp;&nbsp;&nbsp; points-&gt;GetPoint(num,punto2);<br>
      <br>
      You seem to calculate the distance between the same two points in
      every iteration. You need to use i instead of num here.<br>
      <br>
      Regards,<br>
      Dominique<br>
      <br>
      <br>
      On 09.08.2012 18:34, Concetta Piazzese wrote:<br>
    </div>
    <blockquote cite="mid:DUB107-W49D915FDCD00B5B7CAB16597CC0@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
      <div dir="ltr">
        Hy everyone. I hope somebody can help me!<br>
        I need to find the distance between 2 points in millimeters like
        the vtkDistanceWidget does. An user places 10 points and then
        the program compute the distances. The problem is that I have an
        array of vtkPoints and I can't use vtkDistanceWidget to find the
        distances. How I can find the distance? The points positions are
        inglobal coordinate values. The distance I got are totally
        wrong. Here is my code: <br>
        <br>
        int main(int argc, char *argv[])<br>
        {<br>
        &nbsp;&nbsp;&nbsp;
reader-&gt;SetFileName("C:/Tesi/DistanceBetween2Points_build/Debug/Data/Plaque_08.mhd");<br>
        &nbsp;&nbsp;&nbsp; reader-&gt;Update(); <br>
        <br>
        &nbsp;&nbsp;&nbsp; imgconn=reader-&gt;GetOutput();<br>
        <br>
        &nbsp;&nbsp;&nbsp; //Points Placement with vtkSeedWidget. Poins are stored in a
        vtkPoints called "points"<br>
        &nbsp;&nbsp;&nbsp; Seed();<br>
        <br>
        &nbsp;&nbsp;&nbsp; double punto[3];<br>
        &nbsp;&nbsp;&nbsp; double punto2[3];<br>
        <br>
        &nbsp;&nbsp;&nbsp; int num=points-&gt;GetNumberOfPoints();<br>
        <br>
        &nbsp;&nbsp;&nbsp; for (int i=0; i&lt;num; i++)<br>
        &nbsp;&nbsp;&nbsp; {&nbsp; &nbsp;&nbsp; <br>
        &nbsp;&nbsp;&nbsp; points-&gt;GetPoint(num-1,punto);<br>
        &nbsp;&nbsp;&nbsp; points-&gt;GetPoint(num,punto2);<br>
        <br>
        &nbsp;&nbsp;&nbsp; double squaredDistance;<br>
        &nbsp;&nbsp;&nbsp; double dist;<br>
        <br>
        &nbsp;&nbsp;&nbsp; // Distance<br>
        &nbsp;&nbsp;&nbsp; squaredDistance = vtkMath::Distance2BetweenPoints(punto,
        punto2);<br>
        &nbsp;&nbsp;&nbsp; dist=sqrt(squaredDistance);<br>
        &nbsp;&nbsp;&nbsp; <br>
        &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "Distance " &lt;&lt; dist &lt;&lt;
        std::endl;<br>
        &nbsp;<br>
        &nbsp;&nbsp;&nbsp; }<br>
        <br>
        &nbsp;&nbsp;&nbsp; return EXIT_SUCCESS;<br>
        }<br>
        <br>
        What's the problem? vtkDistanceWidget computes distances using
        vtkMath::Distance2BetweenPoints. So what am I doing wrong?<br>
        Thank you!<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
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>
    <br>
    <pre class="moz-signature" cols="72">-- 
Dominique T&ouml;pfer, Dipl.-Inform.
Institute of Medical Physics
University of Erlangen</pre>
  </body>
</html>