The problem seems to be the difference in scale between sphere and plane in this case. If you set the normal to the plane to be 0,radius,0 you get good results.<br><br>This is not an expected result. Need to understand better what is going on.<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 class="HOEnZb"><font color="#888888"><br>
- David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Thu, Oct 4, 2012 at 5:05 PM, Sebastien Jourdain<br>
<<a href="mailto:sebastien.jourdain@kitware.com">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">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"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>