<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>RE: [vtkusers] Mean Curvature</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>It is a bug in VTK. It always gives you a determinant of zero when you extract tensor components. On inspection of file<BR>
<BR>
./VTK/Graphics/vtkExtractTensorComponents.cxx<BR>
<BR>
you see:<BR>
&nbsp; else //VTK_EXTRACT_EFFECTIVE_DETERMINANT<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
<BR>
ie. the determinant is simply not evaluated.<BR>
<BR>
The fix is<BR>
<BR>
&nbsp;else //VTK_EXTRACT_EFFECTIVE_DETERMINANT<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s = tensor[0]*(tensor[4]*tensor[8]-tensor[5]*tensor[7]) -<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tensor[1]*(tensor[3]*tensor[8]-tensor[5]*tensor[6]) +<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tensor[2]*(tensor[3]*tensor[7]-tensor[4]*tensor[6]);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
<BR>
Cheers<BR>
Gerard.<BR>
<BR>
-----Original Message-----<BR>
From: vtkusers-bounces+g.gorman=imperial.ac.uk@vtk.org on behalf of Philip Batchelor<BR>
Sent: Tue 7/5/2005 4:23 PM<BR>
To: Prathap Nair<BR>
Cc: vtkusers@vtk.org<BR>
Subject: Re: [vtkusers] Mean Curvature<BR>
<BR>
Hi<BR>
<BR>
I am not sure why you get this, would need to see the data I guess.<BR>
There are some 'constant mean curvature' surfaces, but if you found one<BR>
by luck, you'll make<BR>
&nbsp;many researchers in maths very jealous...<BR>
<BR>
NB: the curvatures class are meant to be upgraded to have a more general<BR>
structure, and include tensor computations, which would give access to<BR>
principal curvatures directly.<BR>
In the meantime, you are welcome to try this temporary class (with<BR>
proviso that it is rather untested).<BR>
<BR>
Ph<BR>
<BR>
<BR>
Prathap Nair wrote:<BR>
<BR>
&gt; Hello,<BR>
&gt;&nbsp;<BR>
&gt; I am using VTK 4.2 on Windows XP with VC++ 6.0 and am relatively new<BR>
&gt; to VTK. I am doing a project where I have to register two 2.5 D scans<BR>
&gt; (two surfaces) which are in wavefront obj format. I have had no<BR>
&gt; problems so far in terms of rendering or implementation of the<BR>
&gt; Iterative Closest Point Transform.<BR>
&gt;&nbsp;<BR>
&gt; Now i need to implement a landmark detection algorithm that needs the<BR>
&gt; values of Gaussian and Mean curvatures at each point of the surface. I<BR>
&gt; have written the code using the VTK class vtkCurvatures and it<BR>
&gt; compiles and runs error free. I am able to get values for Gaussian<BR>
&gt; curvature, but for mean curvature i get the value zero at all points<BR>
&gt; of the scan. Snippet of my code is provided below, if anyone has faced<BR>
&gt; this problem before or knows what I am doing wrong, please please let<BR>
&gt; me know.<BR>
&gt;&nbsp;<BR>
&gt; Thanks in advance.<BR>
&gt;&nbsp;<BR>
&gt; Regards,<BR>
&gt;&nbsp;<BR>
&gt; Prathap Nair<BR>
&gt; Dept of Electronic Engineering,<BR>
&gt; Queen Mary, University of London,<BR>
&gt; Mile End Road, London E1 4NS (UK).<BR>
&gt;&nbsp;<BR>
&gt; /************************Code Snippet***************/<BR>
&gt;&nbsp;<BR>
&gt; //face 3 is a polydata object containing the surface<BR>
&gt; this-&gt;face3-&gt;DeepCopy(face2-&gt;GetOutput());<BR>
&gt;&nbsp;<BR>
&gt; //Get the Mean curvature and store in vtkDoubleArray &quot;mvals&quot;<BR>
&gt; this-&gt;curvm-&gt;SetInput(this-&gt;face3);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //curvm is an<BR>
&gt; object of vtkCurvatures<BR>
&gt; this-&gt;curvm-&gt;SetCurvatureTypeToMean();<BR>
&gt; this-&gt;curvm-&gt;Update();<BR>
&gt; this-&gt;mvals-&gt;DeepCopy(curvm-&gt;GetOutput()-&gt;GetPointData()-&gt;GetScalars());<BR>
&gt; //Get the Gaussian curvature and store in vtkDoubleArray &quot;gvals&quot;<BR>
&gt; this-&gt;curvg-&gt;SetInput(this-&gt;face3);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //curvg is an<BR>
&gt; object of vtkCurvatures<BR>
&gt; this-&gt;curvg-&gt;SetCurvatureTypeToGaussian();<BR>
&gt; this-&gt;curvg-&gt;Update();<BR>
&gt; this-&gt;gvals-&gt;DeepCopy(curvg-&gt;GetOutput()-&gt;GetPointData()-&gt;GetScalars());<BR>
&gt;<BR>
&gt;------------------------------------------------------------------------<BR>
&gt;<BR>
&gt;_______________________________________________<BR>
&gt;This is the private VTK discussion list.<BR>
&gt;Please keep messages on-topic. Check the FAQ at: <A HREF="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A><BR>
&gt;Follow this link to subscribe/unsubscribe:<BR>
&gt;<A HREF="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A><BR>
&gt;&nbsp;<BR>
&gt;<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>