Will,<br><br>Sounds like a good solution.<br><br>Bill<br><br><div class="gmail_quote">On Fri, Oct 5, 2012 at 12:40 PM, Will Schroeder <span dir="ltr"><<a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">One approach is to just add an option to the class which indicates whether the take the sqrt or not. Leave the default behavior alone or you'll be driving a lot of people nuts :-)<br>
W<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Fri, Oct 5, 2012 at 12:09 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think the root of the problem is vtkSphere. Here is the function<br>
that it uses:<br>
<br>
return ( ((x[0] - this->Center[0]) * (x[0] - this->Center[0]) +<br>
(x[1] - this->Center[1]) * (x[1] - this->Center[1]) +<br>
(x[2] - this->Center[2]) * (x[2] - this->Center[2])) -<br>
this->Radius*this->Radius );<br>
<br>
It is computing the squared distance from the surface of the sphere.<br>
This is different from vtkPlane, which computes the linear distance<br>
from the plane. This is definitely going to cause scaling problems<br>
when you combine these two functions with vtkImplicitBoolean.<br>
<br>
VTK's clipping and contouring operations work by doing linearly<br>
interpolating the scalar value along each edge or line segment that is<br>
clipped. In order for the clipping to be done accurately, the<br>
implicit functions must return a signed linear distance from the<br>
surface that the implicit function defines. Because vtkSphere is<br>
returning a squared distance, I have to declare that vtkSphere is<br>
broken.<br>
<br>
It should be using a formula like this:<br>
<br>
double d2 = (dx*dx + dy*dy + dz*dz - r*r);<br>
return (d2 < 0 ? -sqrt(-d2) : sqrt(d2));<br>
<br>
This will make vtkSphere a bit slower, but it will make it give better results.<br>
<span><font color="#888888"><br>
- David<br>
</font></span><div><div><br>
<br>
On Thu, Oct 4, 2012 at 5:05 PM, Sebastien Jourdain<br>
<<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>> wrote:<br>
> Ok then, could you save the 2 output of the vtkSampleFunction to a<br>
> binary vtk file format and upload them to the bug tracker, so I can<br>
> try to clip the dataset inside ParaView.<br>
><br>
> Thanks,<br>
><br>
> Seb<br>
><br>
> On Thu, Oct 4, 2012 at 6:51 PM, Henning Meyer <<a href="mailto:tutmann@gmail.com" target="_blank">tutmann@gmail.com</a>> wrote:<br>
>>> But I don't think the issue come from the contour filter. Did you<br>
>>> tried to just render the SampleFunction ?<br>
>> It looks almost the same in both cases - besides the 1000 * value range in<br>
>> the second example.<br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br>
<a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br><a href="tel:%28518%29%20881-4902" value="+15188814902" target="_blank">(518) 881-4902</a><br>
</font></span><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>